All Posts by Email, Once a Week

Media Temple logo

CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.

Incuding a .php on every page without include()

  • # March 24, 2011 at 12:49 pm

    I want to include a file on every page. I’ve come across this htaccess trick:

    php_value auto_prepend_file /usr/www/users/website/includes/functions.php

    To my delight, it works perfectly. I would just like to know what the standard practice is. How does wordpress achieve this?

    # March 24, 2011 at 1:42 pm

    Doesn’t WordPress uses things like get_footer() to include the footer on every page? Don’t know if thats exactly what you’re looking for though.

    # March 24, 2011 at 2:13 pm

    I’m not using WordPress. I asked if anyone knows hoe WordPress achieves this.

    # March 24, 2011 at 2:45 pm

    It’s loaded in the wp-settings.php file.

    // Load the functions for the active theme, for both parent and child theme if applicable.
    if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
    include( STYLESHEETPATH . '/functions.php' );
    if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
    include( TEMPLATEPATH . '/functions.php' );
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed