Support » Themes and Templates » I can't get my sidebar to show in my own theme

  • Resolved adriesilva

    (@adriesilva)


    Hello,

    I am creating my own theme and it’s very simple and basic right now, including only the index, header, footer, and style sheet.

    I have not been able to include a sidebar yet.. I copied the code from the default wordpress template and still nothing.

    Please help.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter adriesilva

    (@adriesilva)

    I answered you other question.. its resolved, there was a name issue.. now my theme shows up and i’m able to activate it, but still having problems including a sidebar..

    🙁

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    I have to ask the questions:
    1. What function are you using to call the sidebar?
    2. Do you have a sibebar.php file?
    3. Are there any widgets active?

    Thread Starter adriesilva

    (@adriesilva)

    Hi Jose,

    1. I’m using <?php get_sidebar(); ?> and I’m placing just above the get_footer inside the index.php file

    2. I do/did have a sidebar.php file but it’s blank

    3. There are no widgets active or much of anything else, just the Theme and Editor.

    It’s been very difficult to find answers by myself.

    Any suggestions will help.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    If sidebar.php is blank then odds are it is being loaded. You would then need to use dynamic_sidebar( $id ) to call whichever sidebar-id you used in your functions.php file.

    Try using:

    <?php
    /* Sidebar template */
    if ( is_active_sidebar( 'sidebar-1' ) :
      dynamic_sidebar( 'sidebar-1' );
    else:
      the_widget( 'WP_Widget_Search' );
    endif;

    Thread Starter adriesilva

    (@adriesilva)

    hi, i don’t have more than one sidebar right now.

    so i found this article helpful.. I was able to see “widgets” and “menus” but i’m no where close to learning about menus yet:

    In functions.php, put:

    <?php
    /**
     * Register our sidebars and widgetized areas.
     *
     */
    function arphabet_widgets_init() {
    
    	register_sidebar( array(
    		'name' => 'Home right sidebar',
    		'id' => 'home_right_1',
    		'before_widget' => '<div>',
    		'after_widget' => '</div>',
    		'before_title' => '<h2 class="rounded">',
    		'after_title' => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'arphabet_widgets_init' );
    ?>
    
    Then place this code where you want your widget/sidebar to show:
    
    <?php
    if ( dynamic_sidebar('home_right_1') ) :
    else :
    ?>
    <?php endif; ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I have yet to learn how to add more than this one sidebar. But I’m going to keep searching. And if you can help that would be great too! 🙂

    Thread Starter adriesilva

    (@adriesilva)

    OH! Do you know how to horizontally align the sidebar?

    I’m sure it would be done with css.. and I feel comfortable with css/html.

    Thread Starter adriesilva

    (@adriesilva)

    dang.. i got an error now with that code.

    i’m totally lost because so much is outdated info.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    What part are you lost on? If you read the Codex it will help you understand a little more.

    Made a quick little explanation about how to register and use a sidebar Hope that helps you understand a little more. 🙂

    Thread Starter adriesilva

    (@adriesilva)

    Okey thank you, that should help a lot.. and i’m tired of the Codex.. too much outdated info and an overload.. it drains me just to go from one page to the other without much progress.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘I can't get my sidebar to show in my own theme’ is closed to new replies.