Title: get_posts help
Last modified: August 18, 2016

---

# get_posts help

 *  [rsart](https://wordpress.org/support/users/rsart/)
 * (@rsart)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/get_posts-help/)
 * 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_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](https://wordpress.org/support/users/rsart/)
 * (@rsart)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/get_posts-help/#post-497713)
 * 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.
 *  [ksorbo](https://wordpress.org/support/users/ksorbo/)
 * (@ksorbo)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/get_posts-help/#post-497887)
 * 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.

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [ksorbo](https://wordpress.org/support/users/ksorbo/)
 * Last activity: [19 years, 1 month ago](https://wordpress.org/support/topic/get_posts-help/#post-497887)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
