WordPress.org

Support

Support » Themes and Templates » [Resolved] Calling a custom sidebar

[Resolved] Calling a custom sidebar

  • 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!

Viewing 4 replies - 1 through 4 (of 4 total)
  • get_sidebar_annul() is called a “function”, you will have to include(‘sidebar_annul.php’);

    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'); ?>

    Use <?php include (‘sidebar_annul.php’); ?>….

    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!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Calling a custom sidebar’ is closed to new replies.