Dynamic H1 Heading in Twnty Eleven (2 posts)

  1. Tranny
    Posted 5 years ago #

    I've been trying to implement a somewhat dynamic H1 heading for the header of the twenty eleven theme but keep having issue with it not working properly. I came down to this:

    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h1 id="site-title"><span><?php single_cat_title(''); ?></span></h1>
    <h2 id="site-description">at <a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h2>
    <?php /* If this is a single post */ } elseif (is_single()) { ?>
    <h1 id="site-title"><span><?php the_title(); ?></span></h1>
    <h2 id="site-description">at <a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h2>
    <?php /* Everything else */ } else { ?>
    <h1 id="site-title"><span><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></span></h1>
    <h2 id="site-description"><?php bloginfo('description'); ?></h2>
    <?php  } ?>

    ...but the look of the heading is not proper on single/archive pages. It does look proper on other pages though - it is because the hyperlink is not present? Adding a hyperlink to it would defeat the purpose of the idea, does anyone know of a work around to make it look right?

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.

    For this reason, it is recommended that you consider creating a child theme for your customisations. Once your child theme is active, we should be able to help with the customisation.

Topic Closed

This topic has been closed to new replies.

About this Topic