[resolved] Rearranging header items, place title in navbar -- hooks help (11 posts)

  1. Sarah
    Posted 1 year ago #

    I'm trying to rearrange the header items to be:

    logo - site title - nav menu - social icons

    Placing title IN the navbar, as seen here

    I've tried:
    This snippetshowing logo and site title, and this css to add some text:

    	content: "Barberry Farm";
    	color: #fff;
    	font-size: 34px;
    	background-color: #1B100D;
    	font-weight: normal;

    But really what I need is to work with hooks, modifying this gem I received when working on another site:

    add_action('wp_head', 'reorder_header');
    function reorder_header(){
        // detach social block
        remove_action('__navbar', array(TC_header_main::$instance, tc_social_in_header), 10);
        // insert social block after menu
        add_action('__navbar', array(TC_header_main::$instance, tc_social_in_header), 40);

    Link to site
    I don't understand hooks enough to make it work :(
    thank you for any help in advance!!

  2. d4z_c0nf
    Posted 1 year ago #

    Mmm I think I gave you that :P
    Anyway, that was just to put socials after the menu.
    Atm what you need, in my opinion, is to make logo span bigger and navbar and social-block spans smaller :D

    add_filter('tc_logo_class', 'my_logo_class');
    function my_logo_class($original_class){
        return str_replace('span3', 'span5', $original_class);
    add_filter('tc_navbar_wrapper_class', 'my_nw_class');
    function my_nw_class($original_class){
        return str_replace('span9', 'span7', $original_class);
    add_filter('tc_social_header_block_class', 'my_sb_class', 20, 2);
    function my_sb_class($original_class, $resp){
        if ($resp == "resp"){
            return $original_class; /* you have to chose what you want to do with social block in responsive navbar */
            /* you have just one social, span1 is enough, you have also to set its proper margin in your css, in order to have it on the same row of the menu*/
            return str_replace('span5', 'span1', $original_class);

    Hope this helps.. as a start.

    some semi-colon missing.. sorry :D

  3. d4z_c0nf
    Posted 1 year ago #

    my previous error (semi-colon missing) is causing that: Parse error: syntax error, unexpected T_FUNCTION in /home/barberry/public_html/new/wp-content/themes/customizr-child/functions.php on line 21

  4. Sarah
    Posted 1 year ago #

    My genius, dz4_c0nf! Yes, indeed that is your handiwork :)

    So I've tried the code above (got the semi-colon fix, thanks!) and just now having a chance to work with it.

    The issue I'm finding is putting the 'Barberry Farm' text in the navbar.. I think altering the CSS to be the same as the navbar is just going to break when the window scales or is on mobile device, etc..

    Is there a way to put that text before the menu so it's in the bar?


    Just need to figure out which hook could place a widget to the left of the menu, following along with this snippet

  5. d4z_c0nf
    Posted 1 year ago #

    Mmm I see.
    Well if you show the tagline in the navbar and then play a bit with css and spans value? The only concern will be about, as you rightly said, the responsiveness. But you can manage it!

  6. Sarah
    Posted 1 year ago #

    Thanks! Hopefully ;)

    Still trying to hash out the widget option. I can get it to pop up in a bunch of places, just not before the menu/in the navbar :)

    Otherwise that will be my fix! thank you!

  7. d4z_c0nf
    Posted 1 year ago #

    before the menu, you can, but still you will need css rules... is it worthwhile since you can use the tagline which is already there ?
    Anyway what you need to change in that snippet you linked is just the hook.
    default priorities for the non responsive navbar are:
    10: social-block
    20: tagline
    30: menu

    for the responsive are:
    10: social block
    20: menu

    ok we changed the social block position but it's not relevant here so:

    // Place the widget area before the menu
    add_action ('__navbar', 'add_my_widget_area', 15);
    function add_my_widget_area($resp) {
        if ( "resp" == $resp )/*you don't want that in the navbar resp right?*/
        if (function_exists('dynamic_sidebar')) {
            dynamic_sidebar('Extra Header Widget Area');
  8. Sarah
    Posted 1 year ago #


    Nothing like overlooking the obvious due to some serious tunnel vision!

    Glad you pointed that out! And for the extra code. Geez I need to take a step back now and again, don't I..

    :) thank you!!!

  9. d4z_c0nf
    Posted 1 year ago #

    Eheh, yeah I missed that obvious yesterday too. Sometimes happens :D

  10. Sarah
    Posted 1 year ago #

    Ha! Every once in a while.... ;)

    thanks again for the help!!!

  11. d4z_c0nf
    Posted 1 year ago #

    You're welcome! :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic