WordPress.org

Support

Support » How-To and Troubleshooting » PHP Variable in Shortcode

PHP Variable in Shortcode

  • I wrote a simpe PHP script and have been trying to return the results in WordPress shortcodes, but I can’t seem to get it to work. Here is what I have:

    function securetotal() {
        return $secure_total;
    }
    add_shortcode('secure', 'securetotal');

    $secure_total is the predefined variable that I need to be displayed. I can display simple text instead of the variable, but the variable is not transferring any results. Am I missing something? Any ideas?

    Help is much appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Variable in Shortcode’ is closed to new replies.
Skip to toolbar