I have a page template with a query that shows the latest posts with a category ID which is defined by a custom field. All working fine, but I want to add another fixed category ID. My current code:
<?php $my_query = new WP_Query(array( 'cat' => get_post_meta($post->ID, 'custom-field-name', true), 'posts_per_page' => 5, ));?>
So the posts from one fixed category and from one variable category defined by the custom field. How to add this category with ID #1?
- The topic ‘Latest posts from category defined by custom field, add another fixed category?’ is closed to new replies.