arrakistor
Member
Posted 3 years ago #
I have a news website that published 20 to 50 articles a day. Not all news is front-page worthy news. I would like to have only some articles published to the front page, but all articles seen by category. I do not want to backdate and article.
The way I see this as possible is to add a category called front page, and only allow home to display posts in that category. Any other ideas or implementations? Code examples? Plugins that can do this?
The article, The Loop, Exclude Posts from some Category describes the process of excluding posts from a category. I know you need to 'include' all posts in Category x.
Here's an example to include all posts with Category 5 using the WordPress Default theme, in wp-content/themes/default/index.php:
change:
<?php if (have_posts()) : ?>
to:
<?php query_posts($query_string . '&cat=5'); ?>
<?php if (have_posts()) : ?>
arrakistor
Member
Posted 3 years ago #
I've changed home.php to use this:
<?php $recent = new WP_Query("cat=30&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>