• Resolved hkpg123

    (@hkpg123)


    Hi – I wanted to build upon this post:

    Is there a way to only extract part of the URL??
    My domain is like this somebody.com/?referrer=ABC123
    I just want to show the current URL’s referrer ID which is ABC123

    What part do I have to change in Vladimir’s code to change this to only show the referral ID in my case?

    Many thanks!!

    This was from 1 year ago – same forum and question

    brandimor (@brandimor)
    1 year, 11 months ago
    Is there a shortcode or a way to create a shortcode to get the current Site URL?
    I need it for when I develop and move from one site to another and have not found a good way yet and this seems like it might do the trick

    Viewing 1 replies (of 1 total)
    Plugin AuthorVladimir (@gn_themes)
    1 year, 11 months ago
    Hi @brandimor,

    there is no such shortcode, but you can easily create it yourself.

    Add the following snippet to the end of the functions.php file of your active theme or into a site-specific plugin:

    add_action( ‘init’, function() {

    add_shortcode( ‘site_url’, function( $atts = null, $content = null ) {
    return site_url();
    } );

    } );
    Then just use the following shortcode: [site_url]

    Do not use this code on PHP version 5.2 or lower.

    This reply was modified 1 year, 11 months ago by Vladimir. Reason:

The topic ‘Get URL from Shortcode 2’ is closed to new replies.