snipt

Ctrl+h for KB shortcuts

PHP

Fishpig - Run Wordpress Shortcode in Magento

1
2
3
4
<?php
    $shortcode = '[cm_simple_form id=1]';
    echo Mage::helper('wordpress/filter')->process($shortcode);
?>
https://snipt.net/embed/2ba824b6e0854f3956d93060d1ad2c6c/
/raw/2ba824b6e0854f3956d93060d1ad2c6c/
2ba824b6e0854f3956d93060d1ad2c6c
php
PHP
4
2019-08-23T05:58:19
True
False
False
/api/public/snipt/147561/
fishpig-run-wordpress-shortcode-in-magento
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> <span class="nv">$shortcode</span> <span class="o">=</span> <span class="s1">&#39;[cm_simple_form id=1]&#39;</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">echo</span> <span class="nx">Mage</span><span class="o">::</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;wordpress/filter&#39;</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">process</span><span class="p">(</span><span class="nv">$shortcode</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
Fishpig, Magento, PHP, Wordpress