WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Calling a custom sidebar (5 posts)

  1. chrispforr
    Member
    Posted 9 years ago #

    I’m having difficulty calling a custom sidebar. I created a sidebar named sidebar_annul.php and I want to call it from page_annul.php
    I’m not so skilled with php / but anyway I’m trying to use the expression:

    <?php get_sidebar_annul(); ?>

    and I get the error message:

    Fatal error: Call to undefined function: get_sidebar_annul() in c:\apache\htdocs\wordpress\wp-content\themes\fasttrack\page_annul.php on line 25

    I’ve been through “Customizing Your Sidebar� in the Codex and this support forum, can’t find a reference. Suggestions? Thanks in advance!

  2. Beel
    Member
    Posted 9 years ago #

    get_sidebar_annul() is called a "function", you will have to include('sidebar_annul.php');

  3. Kafkaesqui

    Posted 9 years ago #

    You don't get to create function names on the fly (without first creating the function, that is). If you need to include a PHP file into your template, follow the instructions here:

    http://codex.wordpress.org/Customizing_Your_Sidebar#Different_Sidebars_Anyone.3F

    If you run into problems including the file, use the TEMPLATEPATH constant pointing to the correct path of the current template directory:

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

  4. vkaryl
    Member
    Posted 9 years ago #

    Use <?php include ('sidebar_annul.php'); ?>....

  5. chrispforr
    Member
    Posted 9 years ago #

    Success! The latest suggestion:

    <?php include ('sidebar_annul.php'); ?>

    worked fine (altho it put the sidebar in the middle of the page...will have to fix that.)
    I will also look at the Codex link and try the TEMPLATEPATH suggestion. Thanks all!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.