Wordpress: How to Display Posts from a Specific Category on a Page?? - :s

Status
Not open for further replies.

riddarhusetgal

Incongruous Juxtaposition
May 2, 2007
1,864
70
0
How do you do this? I tried the help section of wordpress but of course there were alot of comments from those smart ass helpers like "wordpress wasn't meant to do this" - no shit sherlock?


Anyway, I read something about some loop but I basically did have a straight forward answer like "go to the page template and cut and paste XYZ HERE..."

THAT SORT OF THING...

Let's say you want to create a page called "Best articles", i.e. domain.com/best articles (not domain.com/category/best articles) - I do mean page.

And you want all the articles from a given subcategory - say domain.com/category/articles/top articles to be displayed on that page you have created --->domain.com/best articles


That way, you can write some blah blah blah intro and then it says - see the best artcles: (under here is displayed all the articles you have categorized in domain.com/category/articles/top articles) kind of like "latest articles" or "latest news" or whatever with a link to those posts....

thanks alot to anyone who can help +rep in advance for the lifeline!!
 


Tx. I have tried the Inline plug-in but you have to go and manually list the ID for each page - which is not an option if you are talking about hundreds of posts. Is there a work around that plug in - or another someone else knows?

@ radio - I'll be buying some banners from you just for taking the time to answer....
 
You can try this loop I have used for one of my site. Edit the cat=1 with your category and adjust showpost with a number you want to output that much posts...

1 step: Create a new template. For this open up notepad and insert this code:

Code:
<?php
/*
Template Name: [B][COLOR=Red]yourtemplatename[/COLOR][/B]
*/

<div id="news">
<?php query_posts('cat=[B][COLOR=Red]1[/COLOR][/B]&showposts=[B][COLOR=Red]5[/COLOR][/B]'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php global $more; $more = false; ?>
<div class="mainnews">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="entry_news_info"><?php the_author() ?> | <?php the_time('d. F Y'); ?></div>

<?php the_content('(Read more...)'); ?>
<?php $more = true; ?>
</div>

<?php endwhile; else: ?>
<p>No data available</p>
<?php endif; ?>
</div><!-- END NEWS -->
?>

Save and upload to your host. After that create a new page and select your yourtemplatename from the template dropdown.

DONE :)
 
  • Like
Reactions: riddarhusetgal
Status
Not open for further replies.