Site logo

[Resolved] Dynamic Text Replacement

Home Forums Support [Resolved] Dynamic Text Replacement

Home Forums Support Dynamic Text Replacement

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1692123
    John

    Morning guys,

    Any plans to add Dynamic Text Replacement functionality to the GeneratePress theme and/or GP Premium plugin?

    Thanks & Regards
    John

    #1692318
    David
    Staff
    Customer Support

    Hi there,

    GPP 2.0 introduces Dynamic Data in the Block Element:

    https://generatepress.com/introducing-the-gp-theme-builder/

    Is that what you require – if not can you explain what you would like to be able to do ?

    #1699959
    John

    Hi David

    Sounds like an interesting release although not yet sure how it will work in my case.

    I use GP to create landing pages for Google search ads. To increase ad relevancy and landing page relevancy, I want to use a dynamic text replacement function so that the landing page title reflects the keyword entered searched for in Google.

    Best Regards
    John

    #1700183
    David
    Staff
    Customer Support

    Unfortunately not at this time – not something we had considered within the theme or GP Premium – i am not sure the best method on how we would integrate this – i suppose if we can get a UTM from the browser URL then a dynamic replacement could be performed…. i’ll see what Tom has to say.

    #1700689
    John

    Thanks for looking into it, David. Will await any development with great interest.

    #1700927
    David
    Staff
    Customer Support

    Definitely interesting – we’ll be talking internally … thanks for the headsup!

    #1701990
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Are these parameters in the URL? If so, it wouldn’t be too hard to do right now..

    For example, if you’re using the block editor, you could do this:

    add_filter( 'render_blocks', function( $content ) {
        $text_to_replace = isset( $_GET['my-param'] ) ? $_GET['my-param'] : false;
        $text_to_look_for = '{{replace_me}}';
    
        if ( $text_to_replace ) {
            $content = str_replace( $text_to_look_for, esc_html( $text_to_replace ), $content );
        }
    
        return $content;
    } );

    Just a very basic example 🙂

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