WordPress.org

Ready to get started?Download WordPress

Forums

Adding recent posts in footer (2 posts)

  1. taddmencer
    Member
    Posted 6 years ago #

    This is driving me mad. I've been working on this all day - pulling things from the codex left and right and for crying out loud .. I can't get it.

    Basically, I have two categories. One for the company news and one for articles. What I'm TRYING to do is have three columns in the footer. The first column will pull the last five posts to the 'news' category (id 1) the second column will pull the last fix posts from the 'dev.news' category (id 3 [no idea why 3, but hey ...]) and the last column is just a log in for a 3rd party tool we use.

    The problem I'm having is .. well, it just won't work! I can get it to pull news, but both columns pull the same news. The second column will drop the date.

    NO idea what I'm doing wrong. Probably just because I'm using the same coding for both columns but I have no clue what do to get this to work.

    Here is my code:

    <?php
     $postslist = get_posts('numberposts=5&order=ASC&orderby=post_title&in_category=1');
     foreach ($postslist as $post) :
        setup_postdata($post);
     ?>
     <div>
     <?php the_date(); ?>
     <br />
     <?php the_title(); ?>
     </div>
     <?php endforeach; ?>

    The other will have in_category=3 naturally. But then drop out the_date() information.

    Any help and ideas are GREATLY appreciated!

  2. taddmencer
    Member
    Posted 6 years ago #

    ok - went the plugin route.

    http://rmarsh.com/plugins/recent-posts/

    This does the trick.

Topic Closed

This topic has been closed to new replies.

About this Topic