Using query_posts to get the lastest post title inside a page.
-
I am trying to pull in the latest post of a specific category into a page. I am using the exec-php plugin that allows me to insert php. I can’t seem to get my query correct because it’s pulling two of the same post and displaying them in my page. Can anyone tell me what’s wrong with my query?
<?php query_posts('cat=3&posts_per_page=1&offset=1'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <h2 id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <?php the_title(); ?></a></h2> </div> <?php endwhile; ?> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p> <?php endif; ?>
Any advice would be greatly appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using query_posts to get the lastest post title inside a page.’ is closed to new replies.