If you’ve set up the Customizr theme so that you have you blog posts on a separate page, you might want to include some text or other content above the list of posts. Here’s how:
Let’s say that your separate blog page is called “Blog” and has the slug “blog”.
Add the following code to your functions.php:
// Add content of page called "blog" to the page that contains the list of blog posts add_action ( '__before_loop', 'add_blog_page_content_before_post_list'); function add_blog_page_content_before_post_list() { if ( is_home() ) { $post = get_page_by_path( '/blog' ); echo wpautop($post->post_content); } }
Where to copy/paste this code? => in your functions.php file. We strongly recommend you create a child theme. Download a start-up child theme here.
Remember: you shouldn’t edit the theme’s functions.php.
See How to customize the Customizr WordPress theme for more information on how to set up a functions.php file in a child theme.
8 thoughts on “Enter text above posts on a static blog page”
This is a fantastic discovery. Thanks ElectricFeet, it works brilliantly! Now if only it was as easy to find how to remove my blog page title… 🙂
There’s a CSS solution here
Hi Dave,
Thanks for the link but when I tried applying any of those changes, I could not get rid of the News (blog) page title only. The code would disappear the titles of each article in a blog or remove all page titles but I can’t figure out how to target just the Blog title. I posted a support question in the Customizr forum. Actually, rather than getting rid of it, I want to add space between the Blog Page Main Title and the list of articles. You can see the page on my site here to see what I mean.
Many thanks,
Dave
Probably better to wrap in wpautop…
Right! The snippet has been updated with your proposition.
Thanks for this feedback.
Hi Jessica, you problem can have multiple different causes.
Try to activate the debug mode in WordPress and you might want to read this guide on how to debug the Customizr WordPress theme..
Hope this helps!
Hi, I’m using the child version and whenever I try to edit the functions php the site crashes and all I have is a white screen. Please help.
Hi Jessica. Check also that your functions.php has the right code at the top. Check this article on How to Customize Customizr for details: http://www.presscustomizr.com/customizr/how-to-customize-customizr-wordpress-theme/