This is one way to do what you want.
- Use a Custom Field (named category-to-show, or similar) to hold the category id number.
- Write a template to get the Custom Field and use the category number in a call to query_posts().
- Create a Page for each category, put the category id in the custom field and assign the custom template.
How can i get the value from the custom field in the template. Is there any specific code that i need to implement?
You use the get_post_meta() function. Your code would look something like this:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$cat_id = get_post_meta($post->ID,'category-to-show',true);
if (intval($cat_id)) :
query_posts("cat=$cat_id&paged=$paged");
if (have_posts()) : while (have_posts()) : the_post();
// your code to display posts
endwhile;
else :
// code for no posts in category
endif;
else :
// code for no category in custom field
endif;
Thank you very much!… I’ve been waiting for someone to help me..^.^ I am a high school student and a noob to php and wordpress haha… Coding is very fun!