PHP in my shortcode runs before HTML in popup
-
I needed to run some PHP code in my popup. I tried using the plugin called “Insert PHP” (which I used successfully in posts and pages) but the popup just echoes everything (including the shortcodes) as text.
[insert_php] // my php code is here [/insert_php]
I assume there is some kind of incompatibility with this plugin. Can you recommend a PHP plugin that works?
I also tried using your suggestion to someone who had the same issue. You suggested adding my own shortcode to my child theme’s function.php. That worked but the output from my shortcode did not appear where I expected it to. Let me explain.
My popup two bits of HTML with my shortcode in the middle.
HTML part 1 [my_shortcode] HTML part 2
So I expected the output from my shortcode to appear in between my two bits of HTML. Instead, it appeared right at the top of the popup. The two bits of HTML followed:
Output from my shortcode HTML part 1 HTML part 2
I can workaround this problem by expanding my shortcode to incorporate all of the HTML code that precedes my shortcode output. Before I do that (I want to re-use the same strategy about 20 times) I just wondered if there was a way to control where my shortcode output appears in the popup?
Many thanks for your great plugin. Very handy.
- The topic ‘PHP in my shortcode runs before HTML in popup’ is closed to new replies.