• Resolved cardboardbear

    (@cardboardbear)


    I’d like to display my blogroll and my most recent blog entries on static pages on my site that I am not creating through WordPress. My original intention was to PHP include/require a template file that displays this information, but I’m getting the following error:

    Fatal error: Call to undefined function: get_links() in ***DIRECTORY*** on line 10

    Obviously this function isn’t recognized on non-WordPress pages. How else can I do this. Because WordPress files are dynamic I tried to include the template file, but is there a way for me to include a Page?

    All suggestions are much appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • WordPress only displays or manipulates what is in it’s database and a very narrow set of files in the WP tree. Integrating things that aren’t in the file system tree (another site) is a security issue so it’s not done easily. Not that it can’t be done with enough sweat and php.

    It very much depends on your site and page layout as too how much sweat.

    Integrating things that aren’t in the file system tree (another site) is a security issue so it’s not done easily. Not that it can’t be done with enough sweat and php.

    meh.

    @ cardboardbear,
    What you want to do can be done a few different ways.

    The simplest: you can use ANY wordpress function on any other php page by using a standard include to wp-blog-header.php at the top of the file you want to use the WP function on.

    Like so:
    // make sure the path below is correct
    <?php require('./wp-blog-header.php');?>
    // make sure the path above is correct

    your normal page stuff ....

    // start of get_links example below

    <?php get_links(category, 'before', 'after',
    'between', show_images, 'order',
    show_description,show_rating, limit,
    show_updated, echo); ?>

    .. some more of your page stuff...

    —————

    To reiterate, that include allows you to use ANY function, even a function which includes another file for instance.

    Thread Starter cardboardbear

    (@cardboardbear)

    Awesome! That worked perfectly. Thanks!

    you’re welcome ??

    very good. nice information.

    I don’t understand this, but I’m still a novice. I’m trying to get a php events calendar to load on an events page. All of my pages have the same header and side columns, only the content changes. How would I go about including a php-include code without it showing up as code?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP Include/Require Issue’ is closed to new replies.