I just found this thread about the same topic but a different theme at https://wordpress.org/support/topic/add-a-static-paragraph-to-post-page/
How can this be done for the Hemingway theme using the child theme we have?
function neve_child_add_blog_description() {
echo 'The text that you need';
}
add_action( 'neve_before_posts_loop', 'neve_child_add_blog_description' );
-
This reply was modified 2 years, 1 month ago by sailpilot.
Hi @sailpilot,
Hemingway doesn’t trigger an action before the posts loop, so there’s not an equivalent solution to the one you posted. What you can do is to add a function hooked to the get_the_archive_title
filter, and add a conditional checking for the blog archive page. Like so:
function xxx_filter_archive_title( $title ) {
if ( is_home() ) {
$title = 'This is the home title';
}
return $title;
}
add_filter( 'get_the_archive_title', 'xxx_filter_archive_title' );
You can also hook it to the get_the_archive_description
filter, if you prefer the way that looks.
— Anders
Sorry I had to work on some other things and didn’t get to this until now.
I inserted the above function in our function.php file in the Hemingway child theme but it doesn’t seem to do anything.
Am I missing something? or does that function need some modification?
Thanks
@sailpilot Try changing the last line to this:
add_filter( 'get_the_archive_title', 'xxx_filter_archive_title', 20 );
Thanks but it still doesn’t seem to work.
Just to summarize:
Our home page is a static About page, it is not the Blog (posts) page.
We have a Hemingway child theme that has a funtions.php file where I inserted your suggested function.
Is there something that I need to change on your function for our implementation or is it supposed to work as is for anyone using the Hemingway theme?
Hi @sailpilot,
I’ve verified this as working on my local installation, with a Hemingway child theme with the front page set to a static page and a separate page set as the page for posts. You call it a funtions.php
file in your post – is it spelled correctly in the child theme folder? Are other functions in the file working properly?
— Anders
Hi @anlino,
Sorry that was a typo in my last message. It is functions.php in the child theme. And there are several other functions in that file that all work.
Just to be clear I just took your function (below) and just pasted it into the child functions.php file without any changes and I can’t get it to work. I guess there must be some conflict with something?
function xxx_filter_archive_title( $title ) {
if ( is_home() ) {
$title = 'This is the home title';
}
return $title;
}
add_filter( 'get_the_archive_title', 'xxx_filter_archive_title', 20 );