Viewing 9 replies - 1 through 9 (of 9 total)
  • Hey there I didn’t use Enigma theme before but you can do it by yourself a bit code.

    Here is the olution:

    Open the header.php and find the approriate area then add this

    <?php if ( ! dynamic_sidebar( ‘header-right’ ) ) : ?>
    <?php endif; // end sidebar widget area ?>

    and open the function.php and add this:

    function mythemeheader_widgets_init() {

    if ( function_exists(‘register_sidebar’) )
    register_sidebar(array(
    ‘name’ => ‘header-right’,
    ‘id’ => ‘header-right’,
    ‘before_widget’ => ‘<div class=”widgets”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’,
    ));
    }
    add_action( ‘widgets_init’, ‘mythemeheader_widgets_init’ );

    that’s it.

    Thread Starter cayindustries

    (@cayindustries)

    Where is the appropriate area?

    appropriate area can be left of the navigation or right of the logo here would you like to appear it you should place it.

    Thread Starter cayindustries

    (@cayindustries)

    Thanks!

    OK. So I have it, but it is in the header area and I was not accurate as to where I wanted it.

    How can I modify the code to put it as a sticky widget (so it stays in place as I scroll) on the right side of the page where the sidebar would be?

    here is the site and where it is right now. It is marked with TEST and a bunch of arbitrary text.

    https://www.thesocketroll.com/productsr-blue/

    I appreciate your help.

    I’m giving you a modified versions of the header.php and functions.php

    header.php https://pastebin.com/C3DX3bGK
    functions.php https://pastebin.com/9NeaRx1T

    keep backup your original theme files. But keep in your mind header right social and contact info won’t work with my modifications. Instead of them a header widget will work on the right side of the logo. So this way you can use anything in the right side area.

    Thread Starter cayindustries

    (@cayindustries)

    So should I delete everything in my header and functions files and replace it with these new ones you provided or should I just add these to the current files information?

    Also, did you check out my website? I am not using the original social media and contact buttons.

    Thanks again for your help.

    Thread Starter cayindustries

    (@cayindustries)

    I deleted all the code in the header and functions files and replaced it with the code you provided and it broke my site. Any other suggestions?

    It should work without original social media and contact buttons. Maybe you should contact theme author for the modifications.

    Thread Starter cayindustries

    (@cayindustries)

    OK, but should I delete everything in my header and function files or just leave it as is and add this into it?

    When I deleted everything I broke my site. Please advise. Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add a widget to header’ is closed to new replies.