WordPress.org

Support

Support » Plugins and Hacks » [Resolved] list 1 entry for announcements category

[Resolved] list 1 entry for announcements category

  • Generally new to WordPress & php but very excited about it!
    Good with XHTML/CSS.
    Trying to make an announcement section on the homepage more dynamic. I created a category called “announcements” and I want a small section on the homepage to be updated with the 1 most recent post under “announcements” category.

    Currently I just have:

    <?php include(TEMPLATEPATH.'/announcement.txt'); ?>

    That’s work for now but I want to give my client the control to update it. I don’t know how to get it to do what I want it to. I have searched the forums/codex but I’m not looking for the right keywords I think.

    Here’s the site (under development)
    http://www.achildssong.com/2010/

    This is my first theme and I’ve built it with Kubric as a starting point.

    Can someone point me in the right direction?? Is there a plugin that will work for this?

    Is there a way to do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • <div id="announcement">
        <div class="orange_tag">
          <h2>Announcement</h2>
        </div>
    <?php query_posts("posts_per_page=1&category_name=announcements"); ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; ?>
    </div>

    that should query the category of “announcements” and display the most recent post from it. It won’t post the date, time, title etc… just the post body.

    SWWWEEEETTT!!! Worked like a charm man! Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] list 1 entry for announcements category’ is closed to new replies.
Skip to toolbar