Displaying 2 different category posts on outside WordPress page
-
So I am trying to get two different categories to display on my homepage. The blog is located in the /results/ folder. And on the home page I want to display two categories in different sections. One is a “portfolio” category and the other is a “news” category. I can easily display one category, but it gets tricky when I try displaying the second category.
Here is the code I used for the first category:
<?php define('WP_USE_THEMES', false); require('results/wp-blog-header.php'); ?> <? if (is_home()) { query_posts('showposts=1&order=desc&cat=18'); } if (have_posts()) : while (have_posts()) : the_post(); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" id="resultspage"><?php the_title(); ?></a><? the_content(); endwhile; endif; ?>I think it’s pretty straight forward.
Now later on in the code I want to display the “news” category. So I do the following:
<? if (is_home()) { query_posts('showposts=2&order=desc&cat=21'); } if (have_posts()) : while (have_posts()) : the_post(); ?><li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <?php the_title(); ?></a></li><? endwhile; endif; ?>It still display the first category’s post (18) and not the new category. What am I doing wrong? Is this possible?
The topic ‘Displaying 2 different category posts on outside WordPress page’ is closed to new replies.