Replacing a cat ID with a custom field in PHP
-
Hello,
I am trying to self learn the next level(for me) of PHP, s push in the right direction would greatly be appreciated…
I am successfully using the following code to get recent posts from category “5441”
<?php $recent = new WP_Query("cat=5441&showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
I would like to be able to change the category number via Custom Fields.
I have been trying to get the following to work, but do am not understanding how to apply my PHP reference materials to this.
<?php $recent = new WP_Query("cat="get_post_meta($post->ID, "AuthorCatagoryID", true);"&showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
Thank you in advance for any hints or answers.
- The topic ‘Replacing a cat ID with a custom field in PHP’ is closed to new replies.