Archived topic
Customize Blog Post
5 replies · Started by Beau on September 26, 2017
I need to reorganize the information on the single blog post template.
Instead of leading with the featured image, I'm going to have the blog title across the top with the date and then the blog post categories underneath and then have a large centered featured image, followed by the full post.
How do I go about editing this template? I can add to single.php, but I don't dare remove any of it, as there isn't much actual PHP or HTML.
I'll also need to style the 'previous post | next post' as well.
Any help is much appreciated!
Hi Beau,
Do you have an example you can link me to? Sounds like you'll be able to use the Page Header add-on.
Let me know :)
Sure, here is what the individual blog posts need to look like:
http://clients.amlapiana.com/kimstrobel/strobel-ed/website/rnd6/index8.html
Thanks!
Ok, so first you'll want to create a Page Header and apply it to your single posts. More info on that here:
https://docs.generatepress.com/article/page-header-overview/
https://docs.generatepress.com/article/page-header-global-locations/
https://docs.generatepress.com/article/page-header-template-tags/
Then you'll need to hook your featured image into the content:
add_action( 'generate_before_content', 'tu_add_featured_image' );
function tu_add_featured_image() {
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
}
Awesome thank you! Implemented and it's close but I'm getting this:
Catchable fatal error: Object of class WP_Error could not be converted to string in /home/haselti2/public_html/strobeleducation.com-staging/wp-content/plugins/gp-premium/page-header/functions/functions.php on line 1119
Do you have {{custom_field._thumbnail_id}} added in your content? If so, remove that, as we're adding your featured image after the page header.