• 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: https://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?

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

    <?php
    require('./path-to/your-blog/wp-blog-header.php');
    ?>

    Thread Starter jgurley

    (@jgurley)

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

    Thread Starter jgurley

    (@jgurley)

    Strike that — your fix worked. Thanks very much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘cannot “get_archives” from a php include file’ is closed to new replies.