Support » Theme: Bouquet » Create new widget sidebar?

Viewing 15 replies - 16 through 30 (of 33 total)
  • @cooljosh3k: Do you see the new sidebar when navigating to Appearance > Widgets in /wp-admin?

    After you have registered the widget, you next need to add it to a template file in order for it to be viewable on your actual site:

    https://codex.wordpress.org/Widgetizing_Themes#How_to_display_new_Widget_Areas

    No, it does not show up there.

    Based on what you linked, I tried adding the following to the end of my child-theme’s function file:

    
    <?php if ( is_active_sidebar( 'custom_sidebar' ) ) : ?>
    	<div id="sidebar-aside" class="sidebar-aside widget-area" role="complementary">
    		<?php dynamic_sidebar( 'custom_sidebar' ); ?>
    	</div><!-- #primary-sidebar -->
    <?php endif; ?>
    

    I don’t know if I got all the ids right, but in any case I just get the following error when viewing my hompage:

    Parse error: syntax error, unexpected ‘<‘ in /home/tftightr/public_html/wp-content/themes/bouquet-child/functions.php on line 33

    Not sure if related, but I just noticed a new issue with my website. When going via the address “tf2tightrope.com”, my browser end up at “https://tf2tightrope.com/” instead of “https://www.tf2tightrope.com/”.

    My website fails to load and ends up with the error message:

    Warning: Cannot modify header information – headers already sent by (output started at /home/tftightr/public_html/wp-content/themes/bouquet-child/functions.php:2) in /home/tftightr/public_html/wp-includes/pluggable.php on line 1174

    Removing the following fixes the error, but breaks the display of my website:

    
    <?php
    function my_theme_enqueue_styles() {
    
        $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
    
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

    Reverting that code back to what is was before, fixes the issues:

    <?php
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    function my_theme_enqueue_styles() {
    	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }

    Yay, just realised I was supposed to add that code to a new sidebar.php file, not functions.php.

    sidebar.php now has this:

    
    <?php if ( is_active_sidebar( 'sidebar-aside' ) ) : ?>
    	<div id="secondary-sidebar" class="secondary-sidebar widget-area" role="complementary">
    		<?php dynamic_sidebar( 'sidebar-aside' ); ?>
    	</div><!-- #primary-sidebar -->
    <?php endif; ?>
    

    It won’t show up on the right of my blog though, instead it tries to cram it in right under navigation. Also, I notice that my original sidebar that comes with Boutique no longer shows up.

    The positioning of the second sidebar on your site will depend on where you place the following function in your template files:

    <?php dynamic_sidebar( 'sidebar-aside' ); ?>

    Thanks.

    I was able to look up previous support and look at the default Boutique files to figure out where to put it.

    I was able to modify my child themes style.css:

    
    #content {
    	float: left;
    	width: 70%;
    }
    

    Which comes close, but it overlaps my navigation area.

    I also tried:

    
    		</div><!-- #content -->
    <?php get_sidebar(); ?>
    

    But this puts it below the content.

    Is there someway to have it right next to my content area, but also below navigation?

    Can you point me to the page on your site where you’ve added the sidebar? I took a look over http://www.tf2tightrope.com but wasn’t able to see it anywhere.

    It’ll help me to visualise where your sidebar is currently is and to see if the position can be changed with some custom CSS.

    Right now I left it as below the content. It is currently just saying “test” right at the very bottom.

    Hi @cooljosh3k,

    Via your child theme, try adding the sidebar after the following code in index.php, single.php, and any other template files you can find it”

    </div><!-- #primary -->

    After you’ve added the sidebar, the following CSS should float the sidebar to the right:

    #secondary-wrapper {
        float: right;
        width: 29.2434%;
    }

    Close, but it overlaps both the navigation and the content. It is also too high up, as I would prefer it under the navigation, but right of content.

    Hi @cooljosh3k,

    You’ll need to add some custom CSS in order to change the width of the sidebar and float it to the right. As your menu is styled to take up the full width of the screen, you’ll also need to add margin to the top:

    #secondary-sidebar {
        float: right;
        width: 29.2434%;
        margin-top: 210px;
    }

    I recommend removing the widget-area class from the HTML that you’ve added, also, as that class has some styling that impacts layout.

    That seems to just force it far down the bottom on the right.

    I’m still seeing the widget-area class. Could you try removing it?

    Ah, sorry. Done now. I presume you meant in my style.css file.

    Seems a little better, but a tiny amount got clipped of of the navigation area on the right.

Viewing 15 replies - 16 through 30 (of 33 total)
  • The topic ‘Create new widget sidebar?’ is closed to new replies.