Forums

query question (4 posts)

  1. hoss9009
    Member
    Posted 2 years ago #

    Does this look ok?

    <div id="recent-blogs">
                      <h2>Recent Blog News</h2>
    					<?php
                        $latestPost = new WP_Query();
                        $latestPost->query('showposts=1');
                        while ($latestPost->have_posts()) : $latestPost->the_post(); ?>
                            <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
                            <div id="recent-title"><?php the_title() ?></div>
                            <div id="read-more"><a href="<?php the_permalink() ?>">read more ></a></div><div class="clear"></div>
                            <?php endwhile; ?>
                            <div id="sidebar-bottom"></div><div class="clear"></div>
                    </div>
  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    It looks OK - although you'd be better using $latestPost->query('posts_per_page=1');. Why do you ask?

  3. hoss9009
    Member
    Posted 2 years ago #

    Thanks!
    ... because I'm new ;)

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Well, if you hit any problems with it, you know where to ask for help. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic