• Hi everyone!

    It is my first time creating a new widget area via code. I wanted to create a space to include a banner and opt-in right below the main menu. I’ve managed to do that but it doesn’t show the widgets I’m including on the Widget menu. It is currently showing the same content appearing on the footer. If I change the widget on that new area, let’s say from an image to a text line, the actual height of the strip changes but still shows the footer.

    What I’ve done is create a child theme, create a style.css file and rtl.css file (because there was one on the parent theme), create a fucntions.php file with the following code in it:

    <?php
    
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/rtl.css' );
    	wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
    	get_stylesheet_directory_uri() . '/rtl.css',
            array('parent-style')
        );
    }
    
    // Custom widget area.
     register_sidebar( array(
        'name' => __( 'Custom Header Widget', 'cmsmasters'),
        'id' => 'custom-header-widget',
        'description' => __( 'An optional custom widget area for your site', 'cmsmasters' ),
               'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget' => '</aside>',
                'before_title' => '<h3 class="widgettitle">',
                'after_title' => '</h3>'
    ) );

    Then I’ve imported the header.php file from the parent theme and have added the following code right after </header>

    <?php
          if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Custom Header Widget') ) : ?>
    <?php endif; ?>

    I am a bit confused because inside the parent theme folder there is a directory called framework and inside there are files such us theme-functions.php and theme-functions-widgets.php

    Inside this theme-functions.php file there is an area called /* Register Default Theme Sidebars */ where I’ve pasted the following code again (after importing the file on the child theme):

    // Custom widget area.
     register_sidebar( array(
        'name' => __( 'Custom Header Widget', 'cmsmasters'),
        'id' => 'custom-header-widget',
        'description' => __( 'An optional custom widget area for your site', 'cmsmasters' ),
               'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget' => '</aside>',
                'before_title' => '<h3 class="widgettitle">',
                'after_title' => '</h3>'
    ) );

    I know I might be mixing things but it is my first time doing this and I don’t know how to fix this issue. How can I make the new widget area show the actual widgets I’m inserting on it?

    Thanks a lot!

Viewing 3 replies - 1 through 3 (of 3 total)
  • can you post a live link to your site to illustrate the output of the new widget area?

    as there indications that you are using a commercial theme, have you considered to contact the developer of that theme for help?

    Thread Starter sombrasblancas

    (@sombrasblancas)

    The site is http://www.yourhappyhealthyhabits.com/

    I’ve contacted them but they are not willing to help as it involves code editing. They only help with the theme options.

    your foooter widgets are only showing through because you have a fixed footer, and your new header sidebar has no background color to cover that.

    the code seems to be output correctly in the html in the browser – see this section:

    <!-- _________________________ Finish Header _________________________ -->
    
    				<aside id="widget_sp_image-2" class="widget widget_sp_image"><img width="630" height="203" alt="" class="attachment-full aligncenter" style="max-width: 100%;" src="http://www.yourhappyhealthyhabits.com/wp-content/uploads/2015/06/happyhabits-banner1.png" /></aside>	
    
    <!-- _________________________ Start Middle _________________________ -->

    however, due to the CSS of your theme, the new sidebar output seems to be positioned below some existing output of the header or content.

    consider to change the location of the new sidebar code lower down into the content code or higher up into the header code …

    unfortunately, as this forum cannot help with comercial themes, you might need to persist in asking the developer for support with the formatting problem. http://codex.wordpress.org/Forum_Welcome#Commercial_Products

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘New widget area below the menu showing the footer content’ is closed to new replies.