Archived topic
change meta description
8 replies · Started by Rick on June 15, 2020
Hi there,
I would like the Meta description on my posts to be a little different from what it is:
right now the first post shows:
| 11th June 2020 by Rick de Groot
11th June 2020 | by Rick de Groot | Formulas
Which is basically:
Date | "By" & First Name Author |Category
Is that possible with the theme?
Regards,
RIck
Hi there,
you can use the generate_header_entry_meta_items filter:
https://docs.generatepress.com/article/generate_header_entry_meta_items/
Hi there,
That is an interesting article David. Some things I noticed still though.
- I was able to add a category, but it only shows up in the posts, not on the front page.
- Also the formatting just looks a little off. I tried searching the internet for a bit before returning to you. I'm trying to add a separator between each of the items. I'd like one of those pipe symbols "|" to create something like this:
11th June 2020 | by Rick de Groot | Formulas
Maybe this is done in CSS or PHP after all?
Best regards,
Rick
Lets fix the missing Category first - are you using any other functions that change post meta ? Dates names etc....
I don't think so. The only PHP I added is the one we're talking about now, together with the Google Fonts. For the current theme I did import the layout from one of GeneratePress' provided bloglayouts. I don't see anything specific to change Meta data though. I looked in the Additional CSS and PHP snippets plugin.
Also I use this CSS to change the font size:
.entry-meta {
font-size: 80%;
}
And the PHP snippet:
add_filter( 'generate_header_entry_meta_items', function() {
return array(
'date',
'author',
'categories',
);
} );
I was able to add the categories in the front page as well in the customizer. It seems to be an option at:
Layout - blog - Content.
I added the author there. The only thing left to do still is to see if I can separate the items with a pipe symbol. CSS maybe?
Try this CSS:
.entry-meta span:not(:last-child):after {
content: '|';
margin: 0 5px;
color: #aaa;
}
You did it again David. Do they also call you magician around the office? ;-)
I'm really enjoying the time since I bought GeneratePress. I knew nothing about HTML, or CSS, but with some tips from friends I've been able to make quite some adjustments already. It's almost completely to my liking now. And your help here is highly appreciated. I just wanted to put that out there.
Thanks again,
Rick
I get called quite a few things .... lol
You're very welcome. Glad we can be of help. And thanks for the feedback we really appreciate it.