• benreneke

    (@benreneke)


    Hi,
    Thanks for making this plugin!

    I want to know if there is a way to insert URL param into shortcode using your plugin?

    In my case, i give a link to my client:
    https://mywebsite.fr/mypage?myurlparam=value

    I want to insert the “value” of “myurlparam” into “myshortcode”, something like :

    [insert_php]
    echo do_shortcode('[myshortcode att="'.$_POST[myurlparam].'"]');
    [/insert_php]

    An idea? is it possible with your plugin? i’m noobie in code…

    Thx for help!

    https://ww.wp.xz.cn/plugins/insert-php/

Viewing 2 replies - 1 through 2 (of 2 total)
  • WillBontrager

    (@willbontrager)

    benreneke, values in URLs are $_GET values instead of $_POST values.

    Whether or not the GET parameter survives depends on your Permalink Settings. The available $_GET values can be displayed like this:

    <pre>
    [insert_php]
    echo print_r($_GET,true);
    [/insert_php]
    </pre>

    When you know what’s available, you know what you can use.

    I’m uncertain what the do_shortcode() function is supposed to do. It might or might not be compatible with Insert PHP.

    (Although it looks like it, [insert_php]…[/insert_php] is not a shortcode. Instead, they are placeholders for PHP code for the plugin to run.)

    http://php.net/search.php is a good reference for PHP functions.

    http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php is a good reference for Insert PHP.

    Will

    Thread Starter benreneke

    (@benreneke)

    It works for me!

    [insert_php]
    echo do_shortcode('[myshortcode att="'.$_GET[myurlparam].'"]');
    [/insert_php]

    Thx a lot for your reactivity!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘pass URL param into shortcode’ is closed to new replies.