WordPress.org

Forums

get_posts issues (1 post)

  1. monitordown
    Member
    Posted 2 years ago #

    The homepage of my site has three areas where content is pulled from other places: two places where an excerpt is pulled with "read more" links, and one area where an entire page of content is pulled. I have hard-coded one of them to display correctly, but the other two are not pulling anything.

    The problem seems to be in the php, and it looks like it has something to do with the get_posts parameter. There was no issue before I upgraded to version 3.4.1. The faulty code is below -- does anyone see anything unusual, or that no longer works with version 3.4.1?

    The page in question is the homepage of http://www.tryourla.com.

    Thanks!

    <?php
    $lastposts = get_posts('pagename=featured-restaurant');
    foreach($lastposts as $post) :
    setup_postdata($post);
    ?>
    " id="post-<?php the_ID(); ?>"><img src="http://tryourla.com/wp-content/themes/TryOurLA/images/rocksugar2.jpg" class="highlightimg" alt="featured los angeles restaurant" />
    <?php the_excerpt(); ?>
    <p>" id="post-<?php the_ID(); ?>">read more</p>
    <?php endforeach; ?>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic