Title: get recent posts problems
Last modified: August 18, 2016

---

# get recent posts problems

 *  [auxillary](https://wordpress.org/support/users/auxillary/)
 * (@auxillary)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/get-recent-posts-problems/)
 * I have created a complete new php page – favorits.php. This page becomes ‘included’
   in my wp template.
 * In this page I want to display the recent posts. I have used this code:
    -  <?php
       $posts = get_posts(‘numberposts=5&offset=1&category=1’); foreach($
      posts as $post) : ?>
    -  — <?php the_excerpt(); ?>
    -  <?php endforeach; ?>
 * But when looking at this page I get an error:
    “Fatal error: Call to undefined
   function get_posts() in /home/sites/site194/web/cms/wp-content/themes/hemingway/
   favorits.php on line 15”
 * This own creation php file is located in the theme directory!
 * Anyone, any idea what could be wrong here? Thanks in advance,
 * Eric

Viewing 1 replies (of 1 total)

 *  [nsn3](https://wordpress.org/support/users/nsn3/)
 * (@nsn3)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/get-recent-posts-problems/#post-353780)
 * I’m using this script.
 * —-
 * <div class=”title”><?php _e(‘Ultimos Posts’); ?></div>
    -  <?php get_recentposts(); ?>
 * —-
 * Then. I turned it to …
 * —-
 * <div class=”title”><?php _e(‘Ultimos Posts’); ?></div>
    -  <?php get_recentposts(‘numberposts=5’); ?>
 * —-
 * … and it appeared the same error.
    The problem must be in that line.

Viewing 1 replies (of 1 total)

The topic ‘get recent posts problems’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [nsn3](https://wordpress.org/support/users/nsn3/)
 * Last activity: [20 years, 2 months ago](https://wordpress.org/support/topic/get-recent-posts-problems/#post-353780)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
