• Hi, I created a few days ago this blog.
    I use a child from Twenty Eleven theme. I would like this configuration in the header. In practice I would like the configuration of the header image like when you select from appearance -> header -> display text -> no BUT with the text on the image instead of no text at all. I hope I explained myself πŸ™‚

    Can someone help me?
    Thank you and best regards

Viewing 15 replies - 1 through 15 (of 15 total)
  • well…

    1. Copy the header.php from /themes/twentyeleven to your childtheme directory

    2. Open it and find the following lines (at line 99 by default)

    <?php
    				// Has the text been hidden?
    				if ( 'blank' == get_header_textcolor() ) :
    			?>
    				<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
    				<?php get_search_form(); ?>
    				</div>
    			<?php
    				else :
    			?>
    				<?php get_search_form(); ?>
    			<?php endif; ?>

    Delete it… take care that you are editing in your childthemes header.php

    3. Create an empty functions.php or if you already have your own, use this. Add this between the <?php and ?>

    //add search field to nav-menu
      function fb_add_search_box ( $items, $args ) {
          // only on primary menu
          if( 'primary' === $args -> theme_location )
              $items .= '<li class="menu-item menu-item-search">' . get_search_form( FALSE ) . '';
          return $items; }
      add_filter( 'wp_nav_menu_items', 'fb_add_search_box', 10, 2 );

    4. Add this to your style.css in your childtheme directory

    /*
      Search Form in Menu
    */
    #access #searchform
    {
      position: static;
      float: right;
      padding-top: 6px;
      padding-right: 4px;
    }
    
    #access input#s
    {
      background-color: #505050;
      border-color: #7c7c7c;
    }
    
    /*
      blog title
    */
    #branding hgroup
    {
      position: absolute;
    }

    5. Change the text-color in your theme-settings (backend) to a better fitting one like white πŸ˜‰

    Hope this will do – let me know…

    [mod: reminder: keep the posted code to 10 lines max – for more use the pastebin]

    Thread Starter manuelmagic

    (@manuelmagic)

    Hi Egado, thank you very much for your big reply!
    I followed all your instructions, and now the text is OVER the header πŸ™‚ … but the search form isn’t displayed. I checked twice the procedure and I followed it right.
    A minor side effect is that now all header image works as a link to the home of the blog (I don’t know why).
    You can check the result here

    Thank you again

    hmm… now the text is on the correct position or?
    The Header is a link to the blog home by default πŸ™‚ we’ve changed – nothing this is twentyeleven itself πŸ˜‰

    searchform… can you pls post your full functions.php from your childtheme directory? (if it has more that 10lines pls use http://pastebin.com/ ) πŸ˜‰

    Thread Starter manuelmagic

    (@manuelmagic)

    Yes, the title is exactly where I wanted (over the header image), thank you!
    About the “link side effect” I was talking about the header image. I know header title is a link, but now it is also almost all the image.

    Here you are my functions.php

    <?php
    add_action( 'after_setup_theme', 'my_child_theme_setup' );
    add_filter( 'wp_nav_menu_items', 'fb_add_search_box', 10, 2 );
    function my_child_theme_setup() {
    	remove_filter( 'body_class', 'twentyeleven_body_classes' );
    }
    function fb_add_search_box ( $items, $args ) {
          if( 'primary' === $args -> theme_location )
              $items .= '<li class="menu-item menu-item-search">' . get_search_form( FALSE ) . '';
    	return $items; }?>

    Thank you for your help

    hmmm… in my twentyeleven theme the hole image is a link by default… should we change it, so that only the text is a link?

    ok… wrong filter, my fault pls delete the old code from step 3 πŸ˜‰ and replace it with this new one…

    //add search field to nav-menu
    add_filter( 'wp_page_menu', 'fb_add_search_box', 10, 2 );
    function fb_add_search_box ( $items, $args ) {
      $items .= '<li class="menu-item menu-item-search">' . get_search_form( FALSE ) . '';
      return $items;
    }

    so your functions.php sould look like this

    <?php
    add_action( 'after_setup_theme', 'my_child_theme_setup' );
    //add search field to nav-menu
    add_filter( 'wp_page_menu', 'fb_add_search_box', 10, 2 );
    function fb_add_search_box ( $items, $args ) {
      $items .= '<li class="menu-item menu-item-search">' . get_search_form( FALSE ) . '';
      return $items;
    }
    ?>
    Thread Starter manuelmagic

    (@manuelmagic)

    Well, I would prefer if only the title is a link a not the whole image.

    The search field is now correctly displayed. I realigned it myself with the sidebar, changing the padding in child styles.css

    #access #searchform
    {
      position: static;
      float: right;
      padding-top: 6px;
      padding-right: 155px;
    }

    But when I click on it extends on the “wrong” direction (left instead of the right). Is it possible to change this?

    And last but not less important: how can I exchange all the help you are giving to me? Really, is there a way?

    Thank for your patience

    Header-Image-Link

    1.)
    Open your header.php (childtheme directiry) and search for
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    delete it

    2.)
    Delete also the closing </a> (probable somewhere in line 94-98)

    3.)
    Save, Upload, Done πŸ™‚

    Search-Field-Direction
    I will try to figure out whats the right solution for you… will getinng some trouble with the positioning πŸ˜‰ dont know if i can fix it this night… but here is a litte update for your functions.php … that will not fix the extending direction but another little mistake… πŸ˜‰

    <?php
    add_action( 'after_setup_theme', 'my_child_theme_setup' );
    //add search field to nav-menu
    add_filter( 'wp_page_menu', 'fb_add_search_box', 10, 2 );
    function fb_add_search_box ( $items, $args ) {
      $items .= get_search_form( FALSE ) . '';
      return $items;
    }
    ?>

    …oy my…
    exchange all the help… yes there is a way… try to help others if you can πŸ™‚ thats all πŸ˜‰

    Thread Starter manuelmagic

    (@manuelmagic)

    Header image now is only a static image, thank you!

    The new function you gave me deleted a ‘β€’’ char in the menu, near the link “Manuel’s web page”. I have noticed before, but with all the help you were (and are) giving to me I didn’t find the courage to ask for such a small thing like that.

    I don’t know if I will be able to help others, I know pratically nothing about CSS and PHP but surely I can reply to the frequently asked question that everyday new people ask because they don’t use the search feature πŸ™‚

    my first test worked πŸ™‚

    childtheme style.css update like it follows:

    #access #searchform
    {
      position: static;
      float: right;
      padding-top: 6px;
      padding-right: 265px;
    }
    
    #access input#s
    {
      background-color: #505050;
      border-color: #7c7c7c;
     position: absolute;
    }

    //EDIT
    I have try to mark πŸ˜€ the changes… pls delete the <strong> </strong> in the css πŸ˜€

    tested in Firefox, Chrome and IE8…

    Thread Starter manuelmagic

    (@manuelmagic)

    It worked but I had to remove those tags. May be it was a formatting error during editing.

    My blog now is exactly like I dreamed πŸ™‚ If you give me an URL I will cite you in my site credits (if you’d like).

    Thank you for all your help!

    Thread Starter manuelmagic

    (@manuelmagic)

    I saw your edit after my message πŸ™‚

    Thread Starter manuelmagic

    (@manuelmagic)

    Well I’m going to bed, will check tomorrow morning for your reply. All technical questions are solved.
    I don’t know if you still can reply if I marked the thread as solved, so I will wait till tomorrow morning to mark as solved.
    Thank you for all your help and good night.

    Good job, looking pretty now πŸ˜‰
    And sorry for my english… its hard to explain sometimes…

    Yeah, that would be nice, but just a little link to http://www.egado.de I’ll still working on the layout… hope my blog is gonne be launched this year πŸ˜€

    You’re Welcome!

    Thread Starter manuelmagic

    (@manuelmagic)

    Your English was completely clear.
    I made the credit page: http://manuelmagic.me/wordpress/?page_id=86

    Thank you for everything.
    Bye

    damn… now i’m a little bit moved to tears – BIG THX for your credits πŸ™‚
    And have a lot of fun with your blog…

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to put title OVER the header image in Twenty Eleven’ is closed to new replies.