WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] Change blog name from H1 to H3 (6 posts)

  1. jamiebisson
    Member
    Posted 1 year ago #

    How do I change the blog name from H1 to H3 on my pages, but still leave it H1 on the home page?

    My site is http://www.eadvancedhealthcare.com

    A page on my site is http://www.eadvancedhealthcare.com/healthcare-resources/ecg-interpretation-and-cardiac-rhythm-recognition/

    Any ideas?

    Jamie

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. CliffAscent
    Member
    Posted 1 year ago #

    You will need to go into your themes files and edit the <h1> tag that the title is in. Go into /wp-admin/ >> Appearances >> Editor and then locate the template files that you want it removed from, such as single.php, archives.php, etc. but not for the home.php and/or index.php files. The line you're seeking should be something like one of the following;

    <h1><?php single_post_title( $prefix, $display ); ?> </h1>

    <h1>" title="<?php the_title_attribute( array( 'before' => 'Permalink to: ', 'after' => '' ) ); ?>"><?php the_title(); ?></h1>

    <h1><?php wp_title( $sep, $echo, $seplocation ); ?> </h1>

    The actual file names and lines of code will vary between themes, but I hope this help.

  3. jamiebisson
    Member
    Posted 1 year ago #

    so i am trying to change the page blog name, so i suppose i am to use page.php, however i only have the following code in this php file:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package WordPress
     * @subpackage Twenty_Twelve
     * @since Twenty Twelve 1.0
     */
    
    get_header(); ?>
    
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', 'page' ); ?>
    				<?php comments_template( '', true ); ?>
    			<?php endwhile; // end of the loop. ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    -----------------------------------------

    any ideas there?

    Jamie

  4. jamiebisson
    Member
    Posted 1 year ago #

    This is in my header.php i am assuming i need to change something here to allow h1 on home page and h3 on normal pages, but i am not sure what to enter.

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
    	<header id="masthead" class="site-header" role="banner">
    		<hgroup>
    			<h1 class="site-title"><a>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    		</hgroup>
  5. jamiebisson
    Member
    Posted 1 year ago #

    I have done a bit more searching and came across this script... will it work for pages and do I put it in my style.css? If so, what lines do i need to delete in my style.css?

    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; $c=0;?>
    <?php while (have_posts()) : the_post(); ?>

    <?php $c++;
    if( $c == 1) :?>
    <h1>The first post on the main index page</h1>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>

    <?php else :?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <?php endif;?>

    <?php endwhile; ?>

    <!-- page nav -->

    <?php endif; ?>`

    ---------------------------------------------

    I also came across this script:

    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; $c=0;?>
    <?php while (have_posts()) : the_post(); ?>

    <?php $c++;
    if( !$paged && $c == 1) :?>
    <h1>The first post on the main index page</h1>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>

    <?php else :?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <?php endif;?>

    <?php endwhile; ?>

    // page nav
    <?php endif; ?>

    Any suggestions people..... anyone???

  6. jamiebisson
    Member
    Posted 1 year ago #

    OK I seem to have fixed it, with the following code in my header.php file

    <header id="masthead" class="site-header" role="banner">
    		<hgroup>
      <?php if (is_front_page()) { ?>
            <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
            <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
      <?php } else { ?>
            <h3 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h3>
            <h4 class="site-description"><?php bloginfo( 'description' ); ?></h4>
      <?php } ?>
    		</hgroup>

    However I now want to make the text size of the h3 and h4 in the site title and site description to the same size and appearance of h1 and h2.

    So in summary for site title (h3) i want the text to look like h1 and in site description (h4) i want the text to look like h2

    Any thoughts?

    Jamie

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic