Archived topic
Move date of blog posts into page header?
9 replies · Started by Christopher on May 7, 2022
Hey there,
Is it possible to move the date and category out of the post DIV and move into into the Header DIV? I would like to start the text of the actual post when the white part of the website starts, as seen in this screenshot. For that I would have to move the date and category up if thats possible at all.
Hi there,
if thats a Block Element and its Element Type is set to Page Hero:
https://docs.generatepress.com/article/block-element-page-hero/
Then:
1. Edit that and add a GB Headline Block and set its Dynamic Data type to Post Date
https://docs.generatepress.com/article/dynamic-data/#post-date
2. In the sidebar settings you will have the option to Disable the stuff you no longer need in the content.
Thanks, that worked. I then noticed that it will apply this change to all subpages as well. Since I only want it on my blog news posts, I created a new page hero element and applied it to Posts > All posts.
It includes the date and then a button for the category:
https://www.screencast.com/t/rmuz4FmoS
Somehow only the date is shown on the live site though and not the category and there also is a huge gab despite not using any margins or paddings. Do you know where this gab is coming from and how I can get the category to show up as well?
https://www.screencast.com/t/quPKXQVIq
Thanks,
Chris
Hi Chris,
Can you create a user account for us to see your site?
Sure, ill post the log in details in the private part.
1. These 2 block element - page hero use the same container ID on the same page, so they share the same CSS. If you want to reuse a block on the same page, try copy and paste, then duplicate it. By duplicating a gb block, you will have a new set of block ids to avoid the CSS confusion. It is a good way to reuse blocks, even for different pages.
https://www.screencast.com/t/XKWbIcrUvUC
2. You didn't choose Taxonomy for the button:
https://www.screencast.com/t/D6IfksWP
Thanks!
Which Hook name do I have to use to get it to this spot?
https://www.screencast.com/t/q7jbt0OBg
Just below the Lets test it headline pretty much.
1. Exclude posts > all posts from the global block element - page hero.
2. Copy and paste the global page hero content to the post block element - page hero, duplicate the entire container, remove the one that directedly pasted to avoid id conflicts.
3. Add the date and category in this duplicated container.
Remember it's better to keep only 1 page hero element for each page.
Thanks, that worked :)
Glad to hear that :)