Archived topic
Regarding post layout
25 replies · Started by Mouse on November 9, 2020
Want the main heading of the post and image to come on top (Centered) and content and sidebar to come after, right now I can see the sidebar is coming alongside with the heading and the image.
Hi there,
create a Header Element for your single posts:
https://docs.generatepress.com/article/header-element-overview/
Add this to the header element content:
<h1>{{post_title}}</h1>
{{custom_field._thumbnail_id}}
Set the Display Rules to Posts > All Posts
This will place the title and the post thumbnail above the content.
Then create a Layout Element with the same display rules to disable the Content Title and Featured Image:
https://docs.generatepress.com/article/layout-element-overview/
I did that one on of my post and now the image is small and not full sized. Link added below
Please help me out with this. I'd be very grateful <3
I want the image to be centered (full image) with title above centered. And want sidebar to start with the main content after that image. With a proper margin/padding so it looks good.
Do you have any custom functions added to your site?
Something similar to this one:
https://generatepress.com/forums/topic/featured-image-in-the-header-element/#post-1472919
No other function is being added. Its all theme.
What's the size of the image you are uploading?
It's only 300 by 221 from what I can tell and that's too small.
Okay then what should I do?
If you want a full-width image, then try uploading something with a width of at least 2000px.
No you are not getting the point. I want the same featured post image and the title above on posts to be centered and align the sidebar with the content that starts after the featured image.
Please see the link in private info. as you can see the sidebar starts alongside the header h1. I want the featured image to be centered and want the sidebar to start aligned with the content after.
Hi still wating on the solution. Please help.
I am attaching the image on what I want to do with the page. Please look at the image. Added in private info.
Here is what you need to do to create that layout.
- Create a [post_thumb] shortcode using the following PHP snippet:
add_shortcode( 'post_thumb', 'db_get_full_thumbnail' );
function db_get_full_thumbnail() {
ob_start();
echo get_the_post_thumbnail( get_queried_object_id(), 'full' );
return ob_get_clean();
}
Adding PHP: https://docs.generatepress.com/article/adding-php/
- Create a header element with the following content:
<h1>{{post_title}}</h1>
[post_thumb]
- Set the horizontal alignment to center:
https://docs.generatepress.com/article/header-element-overview/#horizontal-alignment
Please note that we reply to every question within 12 hours - it's usually much shorter.
Thanks for your patience.