Forums

Pulling Last 5 Posts from Multiple Categories to "Static" Page (1 post)

  1. MikeTek
    Member
    Posted 2 years ago #

    I'm working with the Thesis theme for this website: mgh.unstuckdigital.com

    My problem is on the home page. The "boxes" on the far right for each category are each supposed to list the last 5 post titles as permalinks.

    Here's the code I'm using in each:

    <?php
    $cat=get_cat_ID('work');
    $catposts=get_posts('numberofposts=5&category='.$cat);
    if ($catposts) {
         foreach($catposts as $post)
         setup_postdata($post); ?></p>
    <li><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
         <?php the_title(); ?>
         </a><?php echo $cat?></li>
    <p>
    <?php } ?>

    $cat=get_cat_ID('work') is obviously replaced for each category accordingly.

    Note: I'm using the "static page" feature with the "thesis_hook_custom_template" action to create the home page.

    The odd thing is that the number of items listed matches the number of posts per category - but the permalinks point to the home page and read "home" instead of the post title.

    The numbers displayed in the lists is where I'm printing the Cat ID - to ensure the proper ID is being pulled (it is).

    I apologize if this has been covered elsewhere - I've read through a few dozen posts on similar topics but can't get to the bottom of this.

    Thanks in advance to anyone who takes the time to respond.

    -Mike

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags