1. Home
  2. Docs
  3. Index
  4. Shortcodes
  5. PHP Shortcodes

PHP Shortcodes

This code type allows plugin users to add PHP code to a web page. The code is added to a web page with a shortcode.

Example code

Add to web page

[cmruncode id="25"]

or

[cmruncode name="Hello World"]

Result

Hello World

Custom parameters

The Code Manager supports custom parameters like:

[cmruncode name="Hello World" param1="ABC123" param2="DEF456"]

Use global $wpda_shortcode_args to get access to arguments like:


global $wpda_shortcode_args;
if ( isset( $wpda_shortcode_args['param1'] )  && isset( $wpda_shortcode_args['param2'] ) ) {
	// Your code goes here...
}

 

Was this article helpful to you? Yes No

4 Replies to “PHP Shortcodes”

  1. Hi Peter,

    I want to use the function base64_decode() within some php shortcode. Is this not possible with the free version of Code Manager? If I include it and try and save the code I get a 403 Forbidden message.

    Thanks
    Mark

    1. Hi Mark,

      You should be able to use function base64_decode() in a PHP code block with the free version. There are no limitations on the PHP code. How and where is this code called? Can you share your code? Please use the contactform is you prefer to share this information in private.

      Thanks,
      Peter

    2. Hi Mark,

      You should be able to use function base64_decode() in a PHP code block with the free version. There are no limitations on the PHP code. How and where is this code called? Can you share your code? Please use the contactform is you prefer to share this information in private.

      Thanks,
      Peter

Leave a Reply to admin Cancel reply

Your email address will not be published. Required fields are marked *

5 × one =