• Resolved erlendds

    (@erlendds)


    I’m not sure what cathegory this goes under, so I put it here.
    I see that in the php documents, index.php etc, they all call for different elements using the tag
    <?php get_example(); ?>.
    Where is the document that defines what get_example is?

    I want to have alternative sidebar on my site, I tried making a php document called sidebar2.php and put the php-tag <?php get_sidebar2(); ?> in my index.php. Since this didn’t work, I’m guessing there is a document that defines what all the different “gets” get and that i have to define the sidebar2.php document there.

    Do you understand what I mean? It was kinda hard to explain.

Viewing 2 replies - 1 through 2 (of 2 total)
  • get_header() is a function WordPress ‘defines’ in the general-template.php file (in versions below 2.1, template-functions-general.php), which is found in the wp-includes/ directory. Most of the ‘get_example()’ template functions would be found in this file.

    You have a couple methods for including your sidebar2.php file. Simplest is to use a similar method as get_header() or get_sidebar() does:

    <?php load_template( TEMPLATEPATH . '/sidebar2.php'); ?>

    or the straightfoward PHP way:

    <?php include( TEMPLATEPATH . '/sidebar2.php'); ?>

    Notice both use the constant TEMPLATEPATH, which is defined by WordPress to provide the directory path to the current or active theme.

    The second way would be to create a get_sidebar2() function to include the file, which in WordPress is made easy enough (if you know how to create PHP functions, that is): If a theme has a functions.php file (which would be a basic PHP document), this is loaded first. So custom PHP code or functions placed there would be available to your theme’s templates.

    Thread Starter erlendds

    (@erlendds)

    thanks, I’ll try that

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What document defines <?php get_header(); ?>?’ is closed to new replies.