ThemeShaper Forums » Thematic

Remove blog-description H1 from Pages

(12 posts)
  • Started 2 years ago by bluevoid
  • Latest reply from Chris
  • This topic is not resolved
  1. bluevoid
    Member

    By default, whatever is set as the Blog Description in Settings...General gets output as an H1. In addition, by default, a Page's title is output as an H1. Net effect is two H1 tags on any Page. Baaad Wordpress.

    I'm just trying to remove the Blog Description H1 from each Page. So to my child theme's functions.php I added:

    function remove_parts() {
    if (is_page()) {
    remove_action('thematic_header','thematic_blogdescription',5);
    }
    }
    add_action('init', 'remove_parts');

    However, is_page() seems to be always empty/false. Am I going about this the wrong way? Thanks for the help.

    -Brandon

    Posted 2 years ago #
  2. amygail
    Member

    Hey Brandon
    Unless I'm seriously mistaken, Thematic already does this for you

    Posted 2 years ago #
  3. bluevoid
    Member

    Thanks for that, I would have thought so too. I just realized the duplicate H1's only appear on the front page. I have my front page set to show a Page (not the blog).

    So I tried changing my remove_action to:

    if (is_front_page()) remove_action('thematic_header','thematic_blogdescription',5);

    But still no love; looks like is_front_page() is not returning TRUE properly either.

    Posted 2 years ago #
  4. amygail
    Member

    Hmm - strange. I'm not having that issue - I have a static home on my front page as well.
    Are you using a heavily customized child theme?

    Posted 2 years ago #
  5. bluevoid
    Member

    I don't think so. I tried disabling the All-in-One SEO plugin as well as trashing and copying a fresh thematic directory over. No effect. Wordpress 2.8.3 and Thematic .9.5.1. Only other active plugins: Google Analyticator, NexGen gallery, Widget Logic, and WP Unformatted.

    Only other things I'm doing in my functions.php:
    '
    ... // dynamically add stylesheet links like Ian suggests
    add_filter('thematic_create_stylesheet', 'childtheme_create_stylesheet');

    ... // customize navigation
    add_filter('wp_page_menu', 'childtheme_menu');
    '

    Still also don't understand why is_front_page() isn't working, I guess init is called too early for this to be set?

    Thanks again.

    Posted 2 years ago #
  6. bluevoid
    Member

    So is there any reason Thematic wouldn't remove that H1 automatically?

    Posted 2 years ago #
  7. amygail
    Member

    The theme does use h1 for the blog description on the home page & blog page - but not for interior pages..
    I've read quite a few discussions on the topic and this seems to make sense to me, but obviously, it's a matter of debate

    If you look at this link
    http://themeshaper.com/wordpress-theme-header-template-tutorial/

    scroll down to "The header section"
    and you'll see Ian's reasoning for this structure.

    Posted 2 years ago #
  8. bluevoid
    Member

    Glad I'm not crazy then. That's fine, but having two H1's on the front page is bad any way you look at it.

    I'd rather not hack thematic itself, so is there a way to fix this with filtering?

    Thanks
    Brandon

    Posted 2 years ago #
  9. bluevoid
    Member

    I'm so close. This clued me in: http://themeshaper.com/forums/topic/filtering-something-but-only-on-specific-pages

    Now, it seems to me like this SHOULD work:

    // Remove H1 tag...
    function remove_h1() {
    	remove_action('thematic_header','thematic_blogdescription',5);
    }
    
    // ...but only if this is the front page
    function test_conditionals() {
        if (is_front_page()) add_action('init', 'remove_h1');
    }
    add_action('wp', 'test_conditionals');

    ... but it doesn't. remove_h1() isn't getting called.

    But if I do this:

    function test_conditionals() {
        if (is_front_page()) add_action('init', remove_action('thematic_header','thematic_blogdescription',5));
    }
    add_action('wp', 'test_conditionals');

    It works! But why not the first way, if I needed to do more than one thing?

    Thanks,
    Brandon

    Posted 2 years ago #
  10. bluevoid
    Member

    Anybody? Am I missing something in remove_h1()?

    Posted 2 years ago #
  11. bluevoid
    Member

    I still don't understand why the 2nd code block above works, but not the 1st. It must be something stupidly simple...

    Bump :)

    Posted 2 years ago #
  12. Forget about the 'init' .. works if you remove something without any conditions.

    Take 'wp' instead of it.

    Your code should be:

    function test_conditionals() {
        if (is_front_page()) {
            remove_action('thematic_header','thematic_blogdescription',5);
        }
    }
    add_action('wp', 'test_conditionals');

    Chris

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.