WordPress.org

Ready to get started?Download WordPress

Forums

Adding page title to blog page - Twenty Ten theme (4 posts)

  1. alexcreedy
    Member
    Posted 2 years ago #

    Hi,

    I have a blog page on a website (its not the homepage)

    http://rudmantraining.com/wordpress/blog/

    I want to add a main heading before the first Post that just says 'Blog'. I have tried adding code directly to a new page template as I have done this page which has custom posts :
    http://rudmantraining.com/wordpress/testimonials/

    Also tried adding code to the 'Blog' page in the dashboard but no luck yet.

    Alex

  2. annapootle
    Member
    Posted 2 years ago #

    Does the page display a title by default?

    If not, try going to the Blog page in Dashboard and adding:
    <h1>Blog</h1>
    before any other content.
    But, you may need to go into the template for blog page and edit php.
    Hope this helps!

  3. The_liz
    Member
    Posted 2 years ago #

    Sorry, adding it to the page content simply doesn't work. Here is a moderately quick and dirty method (you are using a child theme, right?):
    -Go to your parent theme and get index.php
    -Right after <?php if ( have_posts() ) : ?> add <h1 class="entry-title">Blog</h1>
    -Save file in your child theme as "home.php"

    If anyone has code for grabbing the blog page title off the page rather than hardcoding it, that'd be cool too.

  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    not sure if this is the most elegant way, but it works to output the blog page (posts page) title when a static front page is set:

    <?php
    if( is_home() && get_option('page_for_posts') ) {
    	$blog_page_id = get_option('page_for_posts');
    	echo '<h1>'.get_page($blog_page_id)->post_title.'</h1>';
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic