• I’ve been trying the examples on the get_posts help page, but each of these seems to break my page.

    Currently I’m hard linking to posts in my ‘Article’ category on my content page. I was doing this because some were posts, and some were pages, but I have now converted all the pages to posts.

    I would now like to be to stop editing the page each time I want another link, and simply display a list of links, in alphabetical order.

    I’ve got the php plugin installed, and other WP template tags are working on the page – my list of all categories and list of posts by time.

    I thoguht it would simply be a matter of using get_posts(), setting the category to 2 and letting it display the links, such as the first example:

      <?php
      $myposts = get_posts(‘numberposts=5&offset=1&category=1’);
      foreach($myposts as $post) :
      ?>

    • “><?php the_title(); ?> — <?php the_excerpt(); ?>
    • <?php endforeach; ?>

    But when I inlcude this in my page, my page breaks and it displays nothing after the header.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter rsart

    (@rsart)

    It seems that the problem is embedding the code in the page. If I paste it into the sidebar, it all works. I guess I’ll have to try to find a plugin to do the job instead.

    Don’t know if this helps or not.

    I was trying to do the same thing. Using a loop just like yours, instead of using the_title(), I used $post->post_title. Worked just fine

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘get_posts help’ is closed to new replies.