Up until now I had a site using posts as pages and the Main Title of those posts displayed the post title - perfect. However I have now added a blog page to display particular posts and now all posts have the Main title & subtitle of the Blog page.
Is this expected behaviour??
Example post as page: http://manatmachine.com/cultivators/ This should have the main title as Cultivators. This post has the Header setting Display Page Title set to show
If this is expected behaviour, is it possible to over-ride it by category? The posts as pages are all in a particular category not displayed on the blog page (http://manatmachine.com/en/blog/)
Posts added under the 'Posts' tab in the WordPress admin will always have the blog page title in the header, as it grabs the page title of the 'page_for_posts'. This is the way the theme is built.
If you really need to display the post title as page title the main-title.php template file needs a slightly edit to achieve that. Please navigate to the following path: the-landscaper/parts and edit the 'main-title.php' file.
Change line 69 from:
$title = get_the_title( $page_id );
to:
$title = get_the_title();
Please note that this will affect also the regular blog posts, if you're using that.
Please note that when updating the theme the changes will be overwritten. If you want to keep updating the theme in the future you should use install the child theme (which is included in the full download package from ThemeForest) and copy the main-title.php from the parent theme in to the child theme folder in the same folder structure (create a folder named 'parts' in the root of the child theme and paste the main-title.php file in to the parts folder).
It didn't change the page of blog posts - still displays the latest blog post title instead of the blog page title and it removes the working change made earlier :(
Hello,
Up until now I had a site using posts as pages and the Main Title of those posts displayed the post title - perfect. However I have now added a blog page to display particular posts and now all posts have the Main title & subtitle of the Blog page.
Is this expected behaviour??
Example post as page: http://manatmachine.com/cultivators/ This should have the main title as Cultivators. This post has the Header setting Display Page Title set to show
If this is expected behaviour, is it possible to over-ride it by category? The posts as pages are all in a particular category not displayed on the blog page (http://manatmachine.com/en/blog/)
Any advice would be welcomed!
Hi Miriam,
Posts added under the 'Posts' tab in the WordPress admin will always have the blog page title in the header, as it grabs the page title of the 'page_for_posts'. This is the way the theme is built.
If you really need to display the post title as page title the main-title.php template file needs a slightly edit to achieve that.
Please navigate to the following path: the-landscaper/parts and edit the 'main-title.php' file.
Change line 69 from:
$title = get_the_title( $page_id );
to:
$title = get_the_title();
Please note that this will affect also the regular blog posts, if you're using that.
If you have any questions, please let me know.
Best regards,
Barry
QreativeThemes.com | WordPress Themes
Yes - that's done the trick, thank you!
It's 99% good now. Apart from the page that displays blog posts, this now shows the title of the latest blog post.
Is it possible to edit the template for this page? Which file is it?
If not, no worries. Will simply not display title on that one page :)
Thanks so much for your help and swift reply
Miriam
Hi Mariam,
That's requires a couple edits in the file:
Change line 67 to:
if ( is_home() ) {
Add a new elseif() below the first if statement:
elseif ( is_single() && 'post' === get_post_type() ) {
$title = get_the_title();
}
That should do the trick.
Please note that when updating the theme the changes will be overwritten. If you want to keep updating the theme in the future you should use install the child theme (which is included in the full download package from ThemeForest) and copy the main-title.php from the parent theme in to the child theme folder in the same folder structure (create a folder named 'parts' in the root of the child theme and paste the main-title.php file in to the parts folder).
If you have any questions, please let me know.
Best regards,
Barry
QreativeThemes.com | WordPress Themes
It didn't change the page of blog posts - still displays the latest blog post title instead of the blog page title and it removes the working change made earlier :(
I may have misunderstood -
This is my code:
This one should work ( I changed it from your example ):
Best regards,
Barry
QreativeThemes.com | WordPress Themes
You absolute star! 100% happy now :)
...and looking at your code it became obvious what I had misunderstood - sorry, I'm not well versed in PHP.
And yes, I am using a child theme as have already hacked about with a couple of templates and added some functions.
Thanks again
Miriam
Great! You're welcome :)
Best regards,
Barry
QreativeThemes.com | WordPress Themes