• Hi everybody. My advertising company wants me to put homepage specific ads on my website. All my advertising is in my sidebar. I figure the easiest way to make homepage specific ads would be to build a homepage specific sidebar.

    I made a custom sidebar and named it frontpagesidebar.php. In my index.php file, I changed <?php get_sidebar(); ?> to
    <?php get_frontpagesidebar(); ?> but that didn’t seem to work (the sidebar just disappeared).

    Any help you can provide would be most appreciated.

    Nick

    Celebslam.com

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php get_frontpagesidebar(); ?> will not work because there is no such function defined in the WP core files (as opposed to get_sidebar which is a WP function.

    To include a file placed in the theme directory, use this:
    <?php include (TEMPLATEPATH . '/frontpagesidebar.php'); ?>
    Use it literally as it is, don’t change anything!

    This way perhaps you don’t need to create a specific home page template:

    <?php if (is_home()) {
    include (TEMPLATEPATH . '/frontpagesidebar.php')
    }
    else{
    get_sidebar();
    }
    ?>

    Thread Starter celebslam

    (@celebslam)

    Awesome thanks; I figured it was probably something easy like that

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I make a homepage specific sidebar’ is closed to new replies.