Archived topic
Add page title to blog page
9 replies · Started by Kim Lindsey on September 4, 2014
We are loving Generate Press so far & have all the Add-Ons installed & activated.
Our site (beta URL is http://neostc.org/cmswp/) has a static Home page, and we are using the blog for the group's newsletter.
On the blog page, we want to add a newsletter title BELOW the page header and (always) ABOVE the first post.
I don't see a way to do this with GP Hooks.
Would this require a child theme? - If so, I'd appreciate some advice as it's the first time I'll be creating/using a child theme. In the generic WP support forums, I found this thread:
http://wordpress.org/support/topic/adding-page-title-to-blog-page-twenty-ten-theme
... but since it's for a different theme, I didn't want to try that method without asking.
Thanks for the great support we've had already with Generate Press! Great theme - makes everything so easy & flexible!
You could try doing something like this in the "Above Content" hook:
<?php if ( is_home() ) : ?>
<header class="entry-header">
<h1 itemprop="headline" class="entry-title">Blog</h1>
</header>
<?php endif; ?>
is_home is only true while on the blog.
Then, you'll have to check the "Execute PHP" checkbox.
Let me know if that does it :)
Thanks Tom! I see from the code that it should only affect the Blog page, which is exactly what we need.
I meet with my newsletter editors tomorrow night - how cool if this can be in place by then to show them!
I'll try it this evening & let you know how it goes.
Thanks again!
Well, the initial solution did not work. Instead of a page title at the top, it puts the text ("Blog" in your sample code) above the title of each individual blog Post.
So then I tried putting your code snippet into the "After Header" hook.
That actually did work!! - except that the text is aligned in the far left margin.
So now I just need to find a way to center it on the page - that would be the perfect position.
If this were a non-WP site, I could probably figure out how to do it, and I'm guessing it's something to do with the .aligncenter class (is that the correct jargon?), but I don't know where to insert it in your sample code for the hook.
** I know you're probably busy with the WP 4.0 update. We hope to go live on 9/10, so if you can help in the next few days, it would be greatly appreciated. Thanks for your help!
Ah - my mistake.
Okay, try this:
<?php if ( is_home() ) : ?>
<div class="grid-container grid-parent">
<header class="entry-header">
<h1 itemprop="headline" class="entry-title">Blog</h1>
</header>
</div>
<?php endif; ?>
That is perfect, except I'd really like it center-aligned.
How do I do that?
(P.S. - I even added an H2 sub-title and it worked great!)
Never mind - I think I got it! I added
align="center"
right after
div class="grid-container grid-parent"
and now both my title & sub-title are center-aligned.
This is so sweet! Kudos to you Tom for a great theme!
Good job!
Using align="center" is kind of old when it comes to coding, so I suggest doing this to the opening div:
<div class="grid-container grid-parent" style="text-align:center;">
Hi Tom,
i used your suggestion in order to show my blog title in the blog homepage, putting it "inside_container", but this made title shown before Yoast breadcrumbs, while in every other pages of the site page title appears after breadcrumbs :(
Can you tell me how to fix this difference?
Thank you in advance!
Hi there,
This is a very old topic so can you raise a new topic and provide a link to the site.