Support » Fixing WordPress » Plugin that can dinamically change links posted in page depending on page url?

Viewing 1 replies (of 1 total)
  • One way would be to create a shortcode which prints the URL dynamically.

    In that case, you would have to use the shortcode inside the post/page content instead of directly referencing the URL.

    For eg. Use this shortcode [dynamic_affiliate_url] instead of directly isng the link in the page/post.

    And the functionality of the shortcode should be something like this:

    function dynamic_affiliate_url( $atts ) {
    	$html = '';
        if( isset( $_GET['aff'] ) ) {
            $aff_param = $_GET['aff'];
            $html = '<a href="https://' . $aff_param . '"> LINK TITLE </a>';
    	return $html;
    add_shortcode( 'dynamic_affiliate_url', 'dynamic_affiliate_url' );

    The above code will go in your theme’s functions.php or a separate plugin of its own.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.