• Resolved databell96

    (@databell96)


    I don’t get this. I’m trying to display just the most recent post from one category called ‘official-news’ on my clients’ homepage and nothing seems to work in my PHP code and I’m trying to avoid using a plugin. The code I’m using is:
    <?php query_posts( 'category_name=official-news&showposts=1' ); ?>
    and I’m trying to incorporate it as follows:

    <?php query_posts( 'category_name=official-news&showposts=1' ); ?>
                 <?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>

    I’ve tried it a couple of different arrangements but I just get all the posts from all the categories instead of just one. What am I doing wrong?

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Can't displays posts on home page from one category’ is closed to new replies.