WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page title posts page (10 posts)

  1. kirstybash
    Member
    Posted 1 year ago #

    Hi there,

    I am using twenty twelve. I have a single posts page (news) on my website. All my other pages have the page title appearing on it apart from my news page.

    Any ideas please?

    Many thanks,
    Kirsty

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    the 'posts page' is generated by index.php;

    to have the page title appear in the 'posts page' you will need to do some coding;

    start by creating a child theme of Twenty Twelve to work with;
    http://codex.wordpress.org/Child_Themes

    (it is not recommended to edit the default theme directly)

    copy index.php into the child theme;

    edit index.php;
    after this line:

    <div id="content" role="main">

    add:

    <?php if( is_home() && get_option('page_for_posts') ) : ?>
    		<header class="entry-header">
    			<h1 class="entry-title"><?php echo apply_filters('the_title',get_page( get_option('page_for_posts') )->post_title); ?></h1>
    		</header>
    		<?php endif; ?>
  3. kirstybash
    Member
    Posted 1 year ago #

    Thank you that works a treat! Next question - could you tell me how to edit the sidebar on the posts page please? I want to add a title to this and display news posts.

    Many thanks in advance,
    Kirsty

  4. kirstybash
    Member
    Posted 1 year ago #

    Hi, I figured out how to edit the sidebar.
    Please can you tell me how to get a title on the single posts page? Currently the post title is appearing as the page title.

    (i.e. when you click through into a post).

    Many thanks,
    Kirsty

  5. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    Please can you tell me how to get a title on the single posts page? Currently the post title is appearing as the page title.

    can you post a link to an example post?

    this would be handled by single.php and content.php of Twenty Twelve, and it should show the post title;

    from content.php:

    <?php if ( is_single() ) : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    			<?php else : ?>
  6. kirstybash
    Member
    Posted 1 year ago #

    Hi

    This is my test News page. http://vip.codestring.co.uk/index.php/news/ which does show the tile.

    If you click through to the blog there is no page title.

    Thanks a lot in advance,
    Kirsty

  7. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    I don't know what other title you expect to see on a single post.

    are you referring to the meta title?

    can you post a link where it does not show a title? and explain what you want to see?

  8. kirstybash
    Member
    Posted 1 year ago #

    Apologies, this is the first news page I have done so not too familiar with how it should look. I was still hoping to see the News page title. Would this be possible?

    Tx,
    Kirsty

  9. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    you can output the 'news' title before the single post title;

    in content.php, edit this section:

    <?php if ( is_single() ) : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>

    for example, change to:

    <?php if ( is_single() ) : ?>
    <?php if( get_option('page_for_posts' ) ) { ?>
    	<h1 class="entry-title news-title"><?php echo apply_filters('the_title',get_page( get_option('page_for_posts') )->post_title); ?></h1>
    <?php } ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>

    (you can use the new .news-title css class for formatting; no idea if this messes with the seo ideas of how to use the h1 tag)

  10. kirstybash
    Member
    Posted 1 year ago #

    OK thanks for your help, in that case I will leave well alone.
    Thanks a lot, I appreciate your reply.

    Kirsty

Topic Closed

This topic has been closed to new replies.

About this Topic