Archived topic
page hero post meta after text
7 replies · Started by Alexander on October 28, 2021
Hi,
i am using gp premium with generateblocks.
I using "page hero block" and the dynamic "post meta"
How can i have a text "after" the dynamic post meta? (Bevor is in plugin function) in one Line.
For example:
Duration: 10 Days
Duration: = Text befor
10 = Post meta
Days = Text after
Thanks
Alex
Hi Alexander,
It might require some CSS.
Can you link us to the page in question?
Hi Ying,
sure... please see in private information
Alex
The block looks like a static block, the headlines are not dynamic block, I'm not sure if the CSS will work when you add the dynamic feature to it, have a try first, if it doesn't work, we can have another look when the dynamic options are activated:
p.gb-headline.gb-headline-5c533e36 .gb-headline-text:after {
content: " Tage";
}
p.gb-headline.gb-headline-2df29bb7 .gb-headline-text:after {
content: " €";
}
Hi Ying,
1. The information has overlapped
Its a dynamic block. I send a screen in private information
2. Your Css works.
But to be honest, i am not happy with a solution like this.
Content should be content... right?
With this solution we get some consequential problems.
Alex
Hi there,
at this time the best method would be to use some Shortcodes instead of the dynamic data to output that content.
You can register your own shortcodes like so:
add_shortcode( 'get_tage', function() {
return get_post_meta( get_the_ID(), 'the_meta_key_for_tage', true );
} );
add_shortcode( 'get_price', function() {
return get_post_meta( get_the_ID(), 'the_meta_key_for_price', true );
} );
in the get_post_meta function you will need to update the_meta_key_for_tage and the_meta_key_for_price to that of your custom field names (keys).
Then you can remove the dynamic data and just add the Shortcode inside the Headline Block with any text before or after that your require eg.
before text [get_tage] after text
Hi David,
Great. Works fine.
Thanks a lot.
Alex
Glad to hear that!