• I’ve got a page template called individual_companies.php which is a child page of companies.php

    Companies.php includes sidebar.php for it’s sidebar content.

    I want the individual_companies.php to have a different sidebar. So this is what i did:

    I took individual_companies.php and replaced this line of code:

    <?php get_sidebar(); ?>

    with this:

    <?php
         $custom_sidebar = get_post_meta($post->ID, 'sidebar', true);
         get_sidebar($custom_sidebar);
    ?>

    Are there any considerations i have to make to include a different sidebar. The code i pasted above is within the loop.

    When i use the regular get_sidebar, it works normally by including the sidebar.php

    The custom field name i added on the page (individual_companies.php page) is sidebar and the value is companies_sidebar.

    Have a look here

    the filename for the sidebar is companies_sidebar.php

    Any help is greatly appreciated..Thanks alot

    Jaysone

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Intended sidebar not appearing’ is closed to new replies.