snipt

Ctrl+h for KB shortcuts

PHP

Interchange Image Wordpress Carrusel ACF

1
2
3
<?php $image = get_sub_field('NOMBRE_SUB_FIELD'); if( $image ): ?>
<img data-interchange="[<?php echo $image['sizes']['CUSTOM_SIZE']; ?>, small], [<?php echo $image['sizes']['CUSTOM_SIZE']; ?>, medium], [<?php echo $image['sizes']['CUSTOM_SIZE']; ?>, large]">
<?php endif; ?>
https://snipt.net/embed/4a10b2569440fc459f8620ddd46dd4e3/
https://snipt.net/raw/4a10b2569440fc459f8620ddd46dd4e3/
4a10b2569440fc459f8620ddd46dd4e3
php
PHP
3
2016-09-28T15:48:32
True
False
False
Aug 05, 2016 at 05:17 PM
/api/public/snipt/147506/
interchange-image-wordpress-carrusel-acf
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> <span class="nv">$image</span> <span class="o">=</span> <span class="nx">get_sub_field</span><span class="p">(</span><span class="s1">&#39;NOMBRE_SUB_FIELD&#39;</span><span class="p">);</span> <span class="k">if</span><span class="p">(</span> <span class="nv">$image</span> <span class="p">)</span><span class="o">:</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="x">&lt;img data-interchange=&quot;[</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$image</span><span class="p">[</span><span class="s1">&#39;sizes&#39;</span><span class="p">][</span><span class="s1">&#39;CUSTOM_SIZE&#39;</span><span class="p">];</span> <span class="cp">?&gt;</span><span class="x">, small], [</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$image</span><span class="p">[</span><span class="s1">&#39;sizes&#39;</span><span class="p">][</span><span class="s1">&#39;CUSTOM_SIZE&#39;</span><span class="p">];</span> <span class="cp">?&gt;</span><span class="x">, medium], [</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nv">$image</span><span class="p">[</span><span class="s1">&#39;sizes&#39;</span><span class="p">][</span><span class="s1">&#39;CUSTOM_SIZE&#39;</span><span class="p">];</span> <span class="cp">?&gt;</span><span class="x">, large]&quot;&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="cp">&lt;?php</span> <span class="k">endif</span><span class="p">;</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
acf, carrusel, wordpress
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.