Show posts in a page from the Category number written in a Custom Field
-
Hi there,
I’m trying to find out a way to show in a page some posts from a category number that I will later specify in a Custom Field called “category”.
I have this working code to modify:
<?php $my_query = new WP_Query('cat=3&posts_per_page=24&orderby=rand'); while ($my_query->have_posts()) : $my_query->the_post(); ?>
I need to replace “cat=3” with something that tells WordPress to take the category number I will write into the Custom Field instead of that number 3.
I think I need something like this:
<?php get_post_custom_values($category, $post_id); ?>
But I am not so expert with PHP to correctly integrate this code in the example above – in fact I always encountered errors.
Any ideas appreciated!
Many thanks[ Please do not bump, that’s not permitted here. ]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show posts in a page from the Category number written in a Custom Field’ is closed to new replies.