• Resolved alkunze

    (@alkunze)


    Hi. I want to display a page title on my blog page, the page of posts. This page is called “Blog” and displays the blogroll of the site. On every other page of my site, the entry-header is displayed at the top of the page, before the page content. However, this entry-header is not displayed on the Blog page, since the page is set up to display posts and is not set up like the other pages. I would like to make a header display at the top of the Blog page that says “BLOG” and is styled the same way as the headers on the other pages. I do not know which PHP document to edit to insert this.

    I am using the theme Twenty Twelve. The URL is https://ashleylkunze.com/sparkplans/
    The URL of the blog page is: https://ashleylkunze.com/sparkplans/blog/

    I am currently working in Google Chrome.

    I have tried to troubleshoot by examining content.php, content-page.php, and index.php. However, I don’t know where to insert PHP code to call for an entry-header above the blogroll of posts, without accidentally inserting a duplicate entry-header on all the other pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • the ‘posts page’ is done with index.php;

    therefore, you will need to edit index.php in your child theme, and add some code (in a similar way as as it is done in content-page.php):

    <?php if( is_home() && get_option( 'page_for_posts' ) ) { ?>
    	<article class="page hentry">
    		<header class="entry-header">
    			<h1 class="entry-title"><?php $posts_page = get_post( get_option( 'page_for_posts' ) ); echo apply_filters( 'the_title', $posts_page->post_title ); ?></h1>
    		</header>
    	</article><!-- .page.hentry -->
    <?php } ?>

    needs to be added after these lines in index.php:

    <div id="primary" class="site-content">
    		<div id="content" role="main">
    Thread Starter alkunze

    (@alkunze)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display page title on blog page’ is closed to new replies.