Archived topic
Missing border on
5 replies · Started by wtm on June 1, 2019
Hi, I was able to add modified date to my header element, however I lost the border that was showing. I originally used this code example #2 (https://docs.generatepress.com/article/page-hero-examples/). Thanks in advance!
Header element code:
<h1>{{post_title}}</h1>
[page_hero_gravatar] {{post_author}} [modified_date]
CSS:
.posted-on .updated {
border-left: 2px solid #fff;
padding-left: 10px;
margin-left: 10px;
}
.posted-on .updated {
display: inline-block;
}
.posted-on .updated + .entry-date {
display: none;
}
.posted-on .updated:before {
content: "Updated: ";
}
PHP:
function post_modified_date() {
return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' );
Hi there,
do you mean the | between the author and the date?
If so you can simply add that to your Header Element content as HTML like so:
[page_hero_gravatar] {{post_author}} | [modified_date]
Thanks, I was able to get that to work, but I still loose the CSS function to add spacing:
.posted-on .updated {
border-left: 2px solid #fff;
padding-left: 10px;
margin-left: 10px;
}
Is it possible to keep this CSS for the border and padding?
Also, how to show "Updated:" left of the date?
.posted-on .updated:before {
content: “Updated: “;
}
So as a result I want it to look like this:
author name | Updated: updated date
Try this instead:
[page_hero_gravatar] {{post_author}} | [modified_date]
Then you can do this:
.hero-modified-date:before {
content: "Updated: ";
}
Thanks for the quick reply, unfortunately that didn't seem to do the trick. Here is what I have, let me know if I'm off with something:
Element code:
[page_hero_gravatar] {{post_author}} | [modified_date]
CSS:
.entry-date {
border-left: 2px solid #fff;
padding-left: 10px;
margin-left: 10px;
}
.posted-on .updated {
display: inline-block;
}
.posted-on .updated + .entry-date {
display: none;
}
.hero-modified-date:before {
content: "Updated: ";
}
PHP:
function post_modified_date() {
return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' );
Thanks!
Why not just add the word to the header element eg.:
[page_hero_gravatar] {{post_author}} | Updated: [modified_date]