ThemeShaper Forums » Thematic

thematic_postheader() - Different heading on index and single

(13 posts)
  • Started 5 years ago by sciamannikoo
  • Latest reply from sciamannikoo
  • This topic is resolved
  1. Before changing something on hooks-filters.php (besides, I don't know yet how), I would like to understand why thematic_postheader() uses <h2> for index.php posts and <h1> on single.php.

    I usually use <h1> on blog's title and <h2> on posts' titles, therefore I have quite some sisues styling my template.

    But maybe I've always used the wrong approach styling my templates. So, I would like to know if there is a special reason for using two different headings for posts't titles.

    Thanks

    Posted 5 years ago #
  2. Hey,

    on your home / frontpage the important thing is your blog / blog title therefore it's an H1. On a single page or page it's the content / the heading therefore the entry-title gets the H1.

    Cheers,

    Chris

    Posted 5 years ago #
  3. Thank you Chris.

    I understand what you mean, but as blog's title is an H1 everywhere, also in single pages, having H1 in post's titles doesn't make much sense, does it?

    Suppose I have this structure on my frontpage:

    '<h1>Blog's title</h1>
    <h2>Post 001</h2>
    <p>Blah, blah, blah, blah</p>
    <h3>Something</h3>
    <p>Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.</p>
    <h3>Again something</h3>
    <p>Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.</p>
    <--more-->'

    On single page I would have:

    '<h1>Blog's title</h1>
    <h1>Post 001</h1>
    <p>Blah, blah, blah, blah</p>
    <h3>Something</h3>
    <p>Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.</p>
    <h3>Again something</h3>
    <p>Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.</p>
    <--more--><p>Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.</p><p>Blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah.</p>'

    As you see, document's struture is broken as I have 2 consecutive <h1> and a missing <h2>.

    I know that this is not an actual issue, but I like to keep my page's structures consistent, not to mention that, on my specific case, posts' titles would have the same style on both frontpage and single page.

    Posted 5 years ago #
  4. Let me see what we can do to provide a short-term solution using a SVN copy.

    Cheers,

    Chris

    Posted 4 years ago #
  5. Well, I'm not sure what are you talking about (I've never really understood what a SVN copy is and how to use it), but I see the work "solution", so I'll (im)patiently wait ;)

    Thanks!

    Posted 4 years ago #
  6. I find the easiest thing to do is style the class or the id opposed to the tag. For example

    #blog-title {background:red;}
    #blog-description {background:pink}
    .entry-title {background:green;}

    instead of

    h1 {background:red;}
    h2 {background:green;}

    And if you look at the source, you shouldn't have any duplicate h1 tags on your single pages and posts.

    Posted 4 years ago #
  7. Yes, this is a workaround, but is not an actual solution.

    My concern is not the style that, I agree with you, could be solved working on IDs and classes.

    I don't want to be tiresome, but I hope you'll understand my point.

    The problem is the structure of the document, the HTML tags. I might be wrong, but is not correct to have two consecutive headers of the same level (H1) or holes between headers (H1 followed by H3).

    Of course the document works and also for the accessibility everything would works fine, but if the blog's title is <h1>, I expect to have post's title <h2>, as we can't consider blog's title at the same level of post's title.

    Is like having a book where, on the index, each article's title id printed with the same identation of newspaper's title.

    Posted 4 years ago #
  8. On the home page it's

    div blog title
    h1 blog description

    h2 post titles

    on single pages it's

    div blog title
    div blog description

    h1 post titles

    There shouldn't be any duplication of h1 tags.

    Posted 4 years ago #
  9. The holes between headers could be considered a problem however. I write my posts using the more tag when I need h2 tags, which solves this.

    Posted 4 years ago #
  10. I've forgot that I've created my own header.php exactly because I was missing my H1 everywhere in the website.

    Well, I still think that blog's title must be kept as H1 everywhere and as you too confirmed, the "holes" between headers could be a problem. Me too, most of the times, I use a more tag before any h2 (well, actually h3 for me), but I never know, but I never know if I may need one day on the excerpt as well.

    However I give up and I think I'll rollback the original header.php and use a different approach, as I really don't want to touch any of the original code.
    Well, actually I have to edit a lot of posts, as I currently use H3 as a main header inside a post (as I've always used H2 as post's title), but this can be done quite fast.

    I just hope you'll consider, in the future, adding a template option (or something else) to let admins select header's behavior (a. like is now; b. same as frontpage).

    Thanks again to both Ian and Chris.

    Posted 4 years ago #
  11. Ok .. you still can implement your changes using the functions.php:

    function remove_parts() {
    	remove_action('thematic_header','thematic_blogtitle',3);
    	remove_action('thematic_header','thematic_blogdescription',5);
    }
    add_action('init', 'remove_parts');
    
    function my_blogtitle() {
      <-- your code -->
    }
    add_action('thematic_header','my_blogtitle',3);
    
    function my_blog_description{
      <-- your code -->
    }
    add_action('thematic_header','my_blogdescription',5);

    You can define whatever <Hx> you want for the header.

    Cheers,

    Chris

    Posted 4 years ago #
  12. Thanks again Chris.

    That sound the best solution for my case.

    I've created the function.php:

    <?php
    
    function remove_parts() {
    	remove_action('thematic_header','thematic_blogtitle',3);
    	remove_action('thematic_header','thematic_blogdescription',5);
    }
    add_action('init', 'remove_parts');
    
    // Create the blog title
    // In the header div
    function thematic_blogtitle() { ?>
        		<div id="blog-title"><h1><a href="<?php echo get_option('home') ?>/"
        		title="<?php bloginfo('name') ?>" rel="home"><?php bloginfo('name') ?>
        		</a></h1></div>
    <?php }
    add_action('thematic_header','thematic_blogtitle',3);
    
    // Create the blog description
    // In the header div
    function thematic_blogdescription() {
    ?>
        		<div id="blog-description"><?php bloginfo('description') ?></div>
    <?php }
    
    add_action('thematic_header','thematic_blogdescription',5);
    ?>

    And now I get this error:

    Fatal error: Cannot redeclare thematic_blogtitle() (previously declared in /home/content/.../wp-content/themes/sciamannablogga/functions.php:12) in /home/content/.../wp-content/themes/thematic/library/extensions/hooks-filters.php on line 36

    Do I (most likely) miss something?

    Posted 4 years ago #
  13. Nevermind, sorry: I've forgot to use custom function names :)

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.