WordPress.org

Forums

[closed] Add text to right side of header? TwentyEleven Theme (9 posts)

  1. Tomtheman2
    Member
    Posted 3 years ago #

    I am using the twentyeleven theme and have removed the code for the search box. I want to put text there instead. E.g a phone number and email address.

    But I cannot figure out, nor find out how I can do this. I have searched the forums but found nothing like what I am after.

    Please help.

    Thanks,

  2. I am using the twentyeleven theme and have removed the code for the search box.

    I hope you've made a child theme instead of modifying the original theme.

    Try using Firebug to identify the CSS where the search form was and tag the text you want to include in the copy of the header.php file.

  3. Tomtheman2
    Member
    Posted 3 years ago #

    Sounds like a good idea, I will try this tomorrow.

    Any more info anyone?

    Thanks,

  4. Tomtheman2
    Member
    Posted 3 years ago #

    I have found this code to insert an image, but I want HTML text there instead.

    Can anyone help me with this, I cannot figure out how to add my own text.

    /* Logo above searchform */
    #branding #searchform {top: 4.8em;} /* moves search down slightly */
    #branding hgroup {
        background: url("images/logo.png");
        background-repeat: no-repeat;
        background-position: 100% 0px;
    
    }
  5. Sorry for not replying sooner, but here's one solution. I don't like it myself but it works. ;)

    Create a child theme and in your twentyeleven-child/style.css file put in these lines.

    http://pastebin.com/n6GEWu1q

    That will hide your header's search form and create a new ID called #myheadertext.

    Now make a copy of the twentyeleven/header.php into the twentyeleven-child directory.

    Here's the part I dislike: modify that copy (not the original) and add right after line 90 this line.

    <h2 id="myheadertext">Contact at +1 555 555 5555</h2>

    http://pastebin.com/LEXQm45V

    The reason I don't like it is because I would rather instead do this in your child theme's functions.php file.

    <?php
    add_filter( 'wp_head' , 'mh_contact_text' );
    function mh_contact_text() {
    	echo '<h2 id="myheadertext">Contact at +1 555 555 5555</h2>';
    }

    But I couldn't work out the CSS to position it correctly on only one cup of coffee. ;)

  6. myavtech@gmail.com
    Member
    Posted 2 years ago #

    Thank you ....I've been trying to solve a similar problem for days. I wanted my biz contact info where the search bar was. I removed the search a different way, and I had the biz info there using <div>, but the text was not searchable.
    my problem solved. thanks again

  7. jortiz8
    Member
    Posted 2 years ago #

    Thank you so much JanD. It worked for me. I now have a telephone # in my header where the search box used to be. I followed your instructions by adding the code to the twentyeleven-child/style.css file and then added your code to the header.php file. I am writng back so others will know that this method worked for me. The only additional code I put in was font-size and font-weight. To center it I changed top: 2.8em to top: 0; I used firebug to locate the code. Cut and pasted to style.css. Below is what it looks like finished. Thanks again.

    #myheadertext {
    font-size:50px;
    position: absolute;
    top: 0;
    right: 7.6%;
    text-align: right;
    font-weight: bold;
    }

    `#myheadertext {
    font-size:50px;
    position: absolute;
    top: 0;
    right: 7.6%;
    text-align: right;
    font-weight: bold;
    }

  8. kittensforgood
    Member
    Posted 2 years ago #

    does that work when someone goes on a mobile device? what would be best for that?

  9. WPyogi
    Forum Moderator
    Posted 2 years ago #

    @kittensforgood - CSS is quite theme and site specific - so what would be best is to start your own thread per the forums guidelines -
    http://codex.wordpress.org/Forum_Welcome#Where_To_Post

    Then someone can look at your site and offer help accordingly.

Topic Closed

This topic has been closed to new replies.

About this Topic