WordPress.org

Support

Support » How-To and Troubleshooting » get recent posts problems

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_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

Viewing 1 replies (of 1 total)
  • 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.