New Blog Templates - Link doesn't dynamically Change

My client wants his affiliates to have a replicated site and I made a blog template of the main website.

The url parameters of the replicated sites are formatted this way:

https://dream-team-freedom.com/referralidofaffiliate

my problem is the buttons within the site doesn't automatically updates when an affiliate registers a new replicated site. The template's URL is

https://dream-team-freedom.com/main-template/

so the buttons (CTA buttons) are like these:
https://dream-team-freedom.com/main-template/shop (example).. etc,

when an affiliate replicates the site the buttons URLs stays like that.

I have tried doing the dynamic url (../shop), but it is not working. Is there a way to automate this and follow the URL of the user?

Thanks.

  • Predrag Dubajic

    Hey Charlene Soan,

    Hope you're doing well today :slight_smile:

    NBT can't go inside content and change the URL's from there as the URL's in there can be to external sites as well.

    What you can do for dynamic address is create your own link with custom shortcodes, here's an example:

    function custom_shortcode() {
    
    	return '<a href="'.get_site_url().'/sample-page" class="my-custom-button">Sample Page</a>';
    
    }
    add_shortcode( 'custom_button', 'custom_shortcode' );

    If you add this to your theme functions.php or create mu-plugin you need to change sample-page with your page slug and then in your page use [custom_button] shortcode to display it.

    You can also use .my-custom-button class to style the link as button.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.