I want to use a php helper to publish shortcodes to my WP page. This will eventually include variables, but for now I just want the shortcodes to parse when the page renders.
I have the below PHP which correctly renders a table for my page...
<?
require_once( 'http://mywebsite.com/wp-load.php' );
$therm_sponsor = "[thermometer raised=0 target=1000]";
$therm_expenses = "[thermometer raised=0 target=1000]";
echo '<table>';
echo '<tbody>';
echo '<tr align="center" valign="middle">';
echo "<td>". do_shortcode($therm_sponsor) ."</td>";
echo "<td>". do_shortcode($therm_expenses) ."</td>";
echo '</tr>';
echo '<tr align="center" valign="middle">';
echo '<td>Funds Raised </td>';
echo '<td>Expenses Covered </td>';
echo '</tr>';
echo '</tbody>';
echo '</table>';
?>
I then include this on my post with the plugin Shortcode Exec, which itself uses a shortcode to include PHP in the page body.
However, when I load the page, I see this table, which includes a text version of the two shortcodes above. In other words, php is correctly outputting the html, but the shortcodes included are not being seen as shortcodes by Wordpress.
FYI the two shortcodes are for a plugin for thermometer tracking donations.
While this might seem like a roundabout way to do this, the main reason is so I can later use php to add dynamic variables to the thermometer shortcodes.
For clarity, here are the steps I use...
- Include the PHP helper with PHP Exec plugin
- Call that on my page with PHP Exec shortcode
- Loading the page indeed renders out my html table from the php helper, but the two shortcodes within the table are not seen by Wordpress as shortcodes, and render at text
How can I make the second layer of shortcodes parse through Wordpress?
Edit: Code updated. Error Fatal error: Call to undefined function do_shortcode()