I am developing a wordpress based website and need help in solving a logic.
What I am trying to achieve is to create a special page template which will have it's own blurb and then a list of posts from a specific category or Tag.
To visualize this, you all might have seen on blog posts that after the post content ends you get a list of related posts. I am looking for same thing but with few twists.
- I want it to be on a page
- I want to define the category or tag while creating the page
- I want to define the no of posts to be listed while creating the page
- Can I have pagination option too?
One solution in my mind is to create Custom page templates for each category and Tag, but I don't want to use that
Second solution is to have a page template with 2 loops, A regular one to get page content, then another one to list posts. I am planning to pass the Category name and no of posts through Custom fields, like
<?php $my_query = new WP_Query('category_name=[B]CUSTOMFIELD1[/B]&posts_per_page=[B]CUSTOMFIELD2[/B]'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<!-- Do special_cat stuff... -->
<?php endwhile; ?>
If above logic makes sense then how to do it?
Any other solution/IDea?
This topic is now archived. It is frozen and cannot be changed in any way.