cannot "get_archives" from a php include file (4 posts)

  1. jgurley
    Posted 10 years ago #

    I've just relaunched my site: deeplyshallow.com

    In the previous version of my site, in a sidebar on the main index template I would display the ten most recent entries.

    In the updated version I've moved that list of recent entries to a separate file. I'm then using a PHP include statement to display that file in a sidebar.

    Here is the include file: http://www.deeplyshallow.com/includes/column2_entries.php

    However, instead of seeing the list of recent entries, there's an error message where the include file should display. It reads:

    Fatal error: Call to undefined function: get_archives() in /home/jason/public_html/includes/column2_entries.html on line 10

    I don't know how to tell the include file to reference my WP database. Can anybody tell me how to set this file up so that it does what I'd like it to?

  2. moshu
    Posted 10 years ago #

    Being outside of your WP install it doesn't "know" what the WP-specific function is.
    Make the file 'WP-aware' - put on the top of it:


  3. jgurley
    Posted 10 years ago #

    What if I'm not using a theme, and therefore not using wp-blog-header.php?

  4. jgurley
    Posted 10 years ago #

    Strike that -- your fix worked. Thanks very much!

Topic Closed

This topic has been closed to new replies.

About this Topic