Removing double h1 in static front page

Home Forums Using Thematic Child Themes Free and Premium Child Themes Removing double h1 in static front page

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  silas 4 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3588

    silas
    Participant

    I am using childs-play with a static front page and I am trying to remove the double h1 that appears

    <h1 id="blog-description">my description</h1>
    ….
    <h1 class="entry-title">Home</h1>
    

    I followed Scott’s suggestion here

    http://thematictheme.com/forums/topic/how-can-i-get-rid-of-the-blog-descripiton-to-avoid-2-h1-tags-on-homepage/

    using

    // removes the H1 on main page which is duplicated when a page is used as a front page
    // also adds the content into a more semantic paragraph tag, where before it was just a div
    function childtheme_override_blogdescription() {
    $blogdesc = ‘"blog-description">’ . get_bloginfo(‘description’, ‘display’);
    echo "t
    
    nn";
    }
    add_action(‘thematic_header’,’childtheme_override_blogdescription’,5);
    

    but I get two blog descriptions instead

    &lt;div id=&quot;blog-title&quot;&gt;&lt;span&gt;&lt;a href=&quot;<a href="http://www.example.com/&#038;quot" rel="nofollow">http://www.example.com/&#038;quot</a>; title=&quot;My Title&quot; rel=&quot;home&quot;&gt;My Title&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
        
        	&lt;p id=&quot;blog-description&quot;&gt;my description&lt;/p&gt;
    
    	&lt;p id=&quot;blog-description&quot;&gt;my description&lt;/p&gt;
    
    		&lt;/div&gt;&lt;!&#8211;  #branding &#8211;&gt;

    I have been trying to figure out what’s wrong for hours without any success.

    What am I missing?

    #3592

    Scott Nix
    Moderator

    There is a subtle difference between the code here and the one I posted, what I posted was a override which completely replaces the previous guts of the function, and the snippet posted above is a filter, which works differently.

    I thought about figuring out how to do the same thing with a filter, but I don’t even know if you can filter it the way it is setup.

    I double checked the snippet on the linked forum post above, it works fine, but don’t add the “add_action” portion of the line, that is what is causing the issue.

    #3594

    silas
    Participant

    You are completely correct (of course!). I hadn’t properly understood how the full blog_description function worked. I thought that you missed out the add_action for simplicity and I assumed I should include it. Effectively I was calling the override function twice 🙁

    Thanks for correcting my error so quickly.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Removing double h1 in static front page’ is closed to new replies.