• Resolved max-sewell

    (@max-sewell)


    https://www.emilyroche.com/blog/

    Hi

    I’ve created a twentythirteen child theme.

    All page titles show on all pages EXCEPT on the blog page. The posts titles show, but not the page titles e.g. (“Blog”). Can I get the page title to display too?

    (NOTE: The nav labels differ from the page names on the site)

    I’ve tried editing page.php and added some css as suggested in related questions/responses, but nothing seems to generate a visible title.

    Thanks for any help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Can I get the page title to display too?

    the posts page is based on index.php, not on page.php, so any coding would need to be done in index.php (in a child theme).

    alternatively, try to add some code like this into functions.php of the child theme:

    add_action( 'the_post', 'show_posts_page_title' );
    
    function show_posts_page_title() { 
    
    	if( get_option( 'page_for_posts' ) && is_home() ) {
    		global $wp_query;
    		if( $wp_query->current_post == 0 && !is_paged() ) {
    			$posts_page = get_post( get_option( 'page_for_posts' ) ); ?>
    
    				<article id="post-<?php echo $posts_page->ID; ?>" class="hentry posts-page" <?php //post_class(); ?>>
    					<header class="entry-header">
    						<h1 class="entry-title"><?php echo apply_filters( 'the_title', $posts_page->post_title ); ?></h1>
    					</header><!-- .entry-header -->
    				</article><!-- #post -->
    
    <?php
    		}
    	}
    }

    PS:
    this does not take care of any meta tags.

    Thread Starter max-sewell

    (@max-sewell)

    You ROCK, Michael. It works like a charm! Thank you very much.

    Max

    This may need to be updated as adding the suggested code caused my site to crash

    @wiziwiz
    depends on how you added the code and where…

    the code is fine as long as you respect any php tags which might need to be used or not …

    what theme are you using, and what have you done with the suggested code?

    I am using port theme – and I just added it to functions.php

    Hello,

    This solution works perfectly for me. I just modified a little the <article> class to meet the display of the title in my template Moka.

    Thank you

    Fabrice

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘twentythirteen: all page titles show but not blog page title?’ is closed to new replies.