Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi guys,
    Sorry to disturb you again I have just managed to add the widget in a better place than before but I still would like to know if it is possible to place the widget area beside my logo.

    Just for the record I have added the following code to get what I have at the moment:

    In functions.php:

    //add a widget area in the header as described by TomHart
    if ( function_exists ('register_sidebar') )
    register_sidebar( array(
      'name' => __( 'Header Widgets Area', 'twentythirteen' ),
      'id' => 'sidebar-header',
      'description' => __( 'Header widgets area for my child theme.' ,  'twentythirteen' ),
      'before_widget' => '<aside id="%1$s" class="widget %2$s">',
      'after_widget' => '</aside>',
      'before_title' => '<h3 class="widget-title">',
      'after_title' => '</h3>',
    ) );

    and in header.php:

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

    Thanks again.

    Hi guy,
    I need your help if possible. You seem to be quite confident with header and widgets.
    I would like to have a currency widget (which I already have) on the header of my site, in order to be visible in every single pages:

    website: debruir.com
    theme: xmarket

    I have followed the instructions written in the following post but I never succeed:

    https://wordpress.org/support/topic/child-theme-adding-a-header-widget-area?replies=23#post-6274259

    I have pasted the following codes in my function.php:

    <?php
    // Add a widget.
    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'name' => 'Extra Widget Before Header',
    'id' => 'extra-widget',
    'description' => 'Extra Widget Before Header',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h2>',
    'after_title' => '</h2>'
    ));
    }
    // Place the widget before the header
    add_filter ('before_navbar', 'add_my_widget');
    function add_my_widget() {
    if (function_exists('dynamic_sidebar')) {
    dynamic_sidebar('Extra Widget Before Header');
    }
    }

    By doing this operation I can see “Extra Widget Before Header” on my WordPress dashboard but, whenever I drag and drop any widgets in the “Extra Widget Before Header” container, it wont work on the front end of my website.

    Am I doing anything wrong?
    I appreciate your attention guys and I hope I can finally solve this issue.

    Thanks

    Thread Starter GarvanForum

    (@garvanforum)

    Any help out there, please?

    Hi guys,
    I need your help please.
    Many times I have tried to create a function.php file in my child team and it would never work, therefore I have given up and gone ahead editing the main function.php (I learned how to use filezilla and wordpress on my own, therefore I do not have a strong knowledge).

    I would like to have a currency widget (which I already have) on the header of my site, in order to be visible in every single pages:

    debruir.com

    I have followed the instructions above and I have pasted the following codes in my function.php:

    <?php
    // Add a widget.
    if (function_exists(‘register_sidebar’)) {
    register_sidebar(array(
    ‘name’ => ‘Extra Widget Before Header’,
    ‘id’ => ‘extra-widget’,
    ‘description’ => ‘Extra Widget Before Header’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’
    ));
    }
    // Place the widget before the header
    add_filter (‘before_navbar’, ‘add_my_widget’);
    function add_my_widget() {
    if (function_exists(‘dynamic_sidebar’)) {
    dynamic_sidebar(‘Extra Widget Before Header’);
    }
    }

    By doing this operation I can see “Extra Widget Before Header” on my WordPress dashboard but, whenever I drag and drop the widget in the “Extra Widget Before Header” container, it wont work on the front end of my website.

    Am I doing anything wrong?
    I appreciate your attention guys and I hope I can finally solve this issue.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)