[Resolved] page hero post meta after text

Home Forums Support [Resolved] page hero post meta after text

Home Forums Support page hero post meta after text

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1980388
    Alexander

    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

    #1980932
    Ying
    Staff
    Customer Support

    Hi Alexander,

    It might require some CSS.

    Can you link us to the page in question?

    #1981813
    Alexander

    Hi Ying,
    sure… please see in private information
    Alex

    #1983001
    Ying
    Staff
    Customer Support

    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: " €";
    }
    #1987586
    Alexander

    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

    #1987932
    David
    Staff
    Customer Support

    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

    #1988053
    Alexander

    Hi David,

    Great. Works fine.
    Thanks a lot.
    Alex

    #1988056
    David
    Staff
    Customer Support

    Glad to hear that!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.