WordPress.org

Ready to get started?Download WordPress

Forums

Am I an idiot? (4 posts)

  1. andytford
    Member
    Posted 5 years ago #

    I've searched the forums up and down (as well as Google) and either don't know what I am searching for, or haven't found it...

    Anyway, I know how to create a custom widget:

    if ( function_exists('register_sidebar') ) {
    register_sidebar(array('name'=>'Home Sidebar','before_widget' => '<div class="widget">','after_widget' => '</div>','before_title' => '<h4>','after_title' => '</h4>',)); }

    ...which will appear in my Admin as Home Sidebar in the drop down. After populating with the plugins I'd like to go into the widget, how do I make the wiget appear in my theme without having to use sidebar.php?

    The plugins in the sidebar are used for interior Pages, whereas I have a custom theme and just want to know how I can insert the custom widgets (and corresponding plugins) with a variation of a php tag for the homepage (home.php)

    Thanks in advance to anyone willing to help ~

  2. If I understand correctly, you're wanting to create a custom sidebar which called home sidebar which will only appear on a particular page.

    To do this create the custom sidebar (called say sidebar-custom.php) as you mention and then use in the template.

    <?php include ('sidebar-custom.php'); ?>

  3. andytford
    Member
    Posted 5 years ago #

    Crondeau,

    That did it! I was making the mistake of naming my custom sidebar 'home-sidebar'. The fundamental element here is that the sidebar must start with the name 'sidebar-[fill in the blank]'

    Thank You again....you've ended hours of endless searching.

  4. Cool, glad to hear that I could help.

Topic Closed

This topic has been closed to new replies.

About this Topic