Reputation: 551
Currently, I have a custom loop with the posts_per_page set to 5. However, I would like the posts_per_page to based on the value of a custom field in a specific 'Page'.
Is this possible?
Thanks
Upvotes: 0
Views: 77
Reputation: 126
$post_id = get_the_ID();
$key = 'custom_field_count';
$post_count = get_post_meta($post_id, $key, true);
$args = array(
'posts_per_page' => $post_count,
);
query_posts($args);
Upvotes: 1