WordPress.org

Ready to get started?Download WordPress

Forums

get recent posts problems (2 posts)

  1. auxillary
    Member
    Posted 8 years ago #

    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_title(); ?> --- <?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

  2. NSN3
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags