Pull one category on a page where page name = category name
-
Hi,
I’m trying to create a sidebar section on a custom page that will show only posts from a category named the same as the page’s name.
Example:
Page’s name = mandarin, side bar shows posts all posts from mandarin category (may be a sub category)This is what I have now:
<?php $recent = new WP_Query(“cat=3&showposts=5”); while($recent->have_posts()) : $recent->the_post();?>
<?php if( get_post_meta($post->ID, “thumbnail”, true) ): ?>
” rel=”bookmark”>
<?php else: ?>
” rel=”bookmark”>
<?php endif; ?>
<b>” rel=”bookmark”><?php the_title(); ?></b>
<?php the_content_limit(200, “”); ?>
<?php endwhile; ?>It shows category #3 only, but I’d like it to be more automated once I create a new page (I use a separate page template for this purpose)
What should I write instead of the category number?
Thanks!!!!
- The topic ‘Pull one category on a page where page name = category name’ is closed to new replies.