snipt

Ctrl+h for KB shortcuts

Text only

Comandos Bootstrap / Compass

1
2
3
compass install bootstrap -r bootstrap-sass

compass create my-new-project -r bootstrap-sass --using bootstrap
https://snipt.net/embed/00b32cf46b3d5a47aab6482e0e71e0b5/
/raw/00b32cf46b3d5a47aab6482e0e71e0b5/
00b32cf46b3d5a47aab6482e0e71e0b5
text
Text only
3
2019-05-31T06:18:43
True
False
False
Sep 22, 2016 at 07:01 PM
/api/public/snipt/147848/
comandos-bootstrap-compass
<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></span><span id="L-1"><a name="L-1"></a>compass install bootstrap -r bootstrap-sass </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>compass create my-new-project -r bootstrap-sass --using bootstrap </span></pre></div> </td></tr></table>
bootstrap

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/
/raw/4a10b2569440fc459f8620ddd46dd4e3/
4a10b2569440fc459f8620ddd46dd4e3
php
PHP
3
2019-06-19T00:09:12
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></span><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

PHP

Related post excluding current post

1
2
3
4
5
6
7
<?php
$currentID = get_the_ID();
$my_query = new WP_Query( array('cat' => '1', 'showposts' => '5', 'post__not_in' => array($currentID)));
while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></h2>
<?php the_content(); ?>
<?php endwhile; ?>
https://snipt.net/embed/2253bb0bc247ecf3bf2c5050102d3289/
/raw/2253bb0bc247ecf3bf2c5050102d3289/
2253bb0bc247ecf3bf2c5050102d3289
php
PHP
7
2019-06-18T17:42:40
True
False
False
Feb 10, 2016 at 07:55 PM
/api/public/snipt/144098/
related-post-excluding-current-post
<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> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</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">$currentID</span> <span class="o">=</span> <span class="nx">get_the_ID</span><span class="p">();</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$my_query</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">WP_Query</span><span class="p">(</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;cat&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;1&#39;</span><span class="p">,</span> <span class="s1">&#39;showposts&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;5&#39;</span><span class="p">,</span> <span class="s1">&#39;post__not_in&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="nv">$currentID</span><span class="p">)));</span> </span><span id="L-4"><a name="L-4"></a><span class="k">while</span> <span class="p">(</span> <span class="nv">$my_query</span><span class="o">-&gt;</span><span class="na">have_posts</span><span class="p">()</span> <span class="p">)</span> <span class="o">:</span> <span class="nv">$my_query</span><span class="o">-&gt;</span><span class="na">the_post</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-5"><a name="L-5"></a><span class="x">&lt;h2&gt;&lt;a href=&quot;</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&quot;&gt;</span><span class="cp">&lt;?php</span> <span class="nx">the_title</span><span class="p">()</span> <span class="cp">?&gt;</span><span class="x">&lt;/a&gt;&lt;/h2&gt;</span> </span><span id="L-6"><a name="L-6"></a><span class="cp">&lt;?php</span> <span class="nx">the_content</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-7"><a name="L-7"></a><span class="cp">&lt;?php</span> <span class="k">endwhile</span><span class="p">;</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
query, related

CSS

Foundation: Block Grid Collapse

1
2
3
4
5
6
7
ul.small-block-grid-1.collapse li, ul.small-block-grid-2.collapse li, ul.small-block-grid-3.collapse li, ul.small-block-grid-4.collapse li, ul.small-block-grid-5.collapse li, ul.small-block-grid-6.collapse li, ul.small-block-grid-7.collapse li, ul.small-block-grid-8.collapse li, ul.large-block-grid-1.collapse li, ul.large-block-grid-2.collapse li, ul.large-block-grid-3.collapse li, ul.large-block-grid-4.collapse li, ul.large-block-grid-5.collapse li, ul.large-block-grid-6.collapse li, ul.large-block-grid-7.collapse li, ul.large-block-grid-8.collapse li{ 
	padding: 0; 
	border-right: 1px solid #F2F2F2;
}
ul.small-block-grid-1.collapse li:last-child, ul.small-block-grid-2.collapse li:last-child, ul.small-block-grid-3.collapse li:last-child, ul.small-block-grid-4.collapse li:last-child, ul.small-block-grid-5.collapse li:last-child, ul.small-block-grid-6.collapse li:last-child, ul.small-block-grid-7.collapse li:last-child, ul.small-block-grid-8.collapse li:last-child, ul.large-block-grid-1.collapse li:last-child, ul.large-block-grid-2.collapse li:last-child, ul.large-block-grid-3.collapse li:last-child, ul.large-block-grid-4.collapse li:last-child, ul.large-block-grid-5.collapse li:last-child, ul.large-block-grid-6.collapse li:last-child, ul.large-block-grid-7.collapse li:last-child, ul.large-block-grid-8.collapse li:last-child{
	border-right:none;
}
https://snipt.net/embed/840dc86a172419ac96fc208e9a222934/
/raw/840dc86a172419ac96fc208e9a222934/
840dc86a172419ac96fc208e9a222934
css
CSS
7
2019-06-14T20:37:33
True
False
False
Feb 01, 2014 at 10:37 PM
/api/public/snipt/110217/
foundation-block-grid-collapse
<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> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nt">ul</span><span class="nc">.small-block-grid-1.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-2.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-3.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-4.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-5.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-6.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-7.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-8.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-1.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-2.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-3.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-4.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-5.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-6.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-7.collapse</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-8.collapse</span> <span class="nt">li</span><span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">padding</span><span class="o">:</span> <span class="m">0</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">border-right</span><span class="o">:</span> <span class="m">1px</span> <span class="nb">solid</span> <span class="m">#F2F2F2</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span><span id="L-5"><a name="L-5"></a><span class="nt">ul</span><span class="nc">.small-block-grid-1.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-2.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-3.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-4.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-5.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-6.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-7.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.small-block-grid-8.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-1.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-2.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-3.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-4.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-5.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-6.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-7.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="o">,</span> <span class="nt">ul</span><span class="nc">.large-block-grid-8.collapse</span> <span class="nt">li</span><span class="nd">:last-child</span><span class="p">{</span> </span><span id="L-6"><a name="L-6"></a> <span class="nb">border-right</span><span class="o">:</span><span class="nb">none</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
"block grid", css, foundation

PHP

Condicional Custom Field ACF

1
2
3
4
5
<?php $nombre_variable = get_post_meta($post->ID, 'nombre_cf', true); if ($nombre_variable) { ?>
<?php the_field('nombre_cf'); ?>
<?php } else { ?>
//mostrar esto
<?php } ?>
https://snipt.net/embed/ea01219ea37c83aa8a575d1028eebec3/
/raw/ea01219ea37c83aa8a575d1028eebec3/
ea01219ea37c83aa8a575d1028eebec3
php
PHP
5
2019-06-08T01:29:28
True
False
False
Nov 27, 2013 at 09:51 AM
/api/public/snipt/97047/
condicional-custom-field-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> <a href="#L-4">4</a> <a href="#L-5">5</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 class="nv">$nombre_variable</span> <span class="o">=</span> <span class="nx">get_post_meta</span><span class="p">(</span><span class="nv">$post</span><span class="o">-&gt;</span><span class="na">ID</span><span class="p">,</span> <span class="s1">&#39;nombre_cf&#39;</span><span class="p">,</span> <span class="k">true</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="nv">$nombre_variable</span><span class="p">)</span> <span class="p">{</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="cp">&lt;?php</span> <span class="nx">the_field</span><span class="p">(</span><span class="s1">&#39;nombre_cf&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-3"><a name="L-3"></a><span class="cp">&lt;?php</span> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-4"><a name="L-4"></a><span class="x">//mostrar esto</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">&lt;?php</span> <span class="p">}</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
"advanced custom fields", condicional, wordpress

PHP

Asignar Clase a Thumbnail Wordpress

1
2
3
4
5
<?php if ( has_post_thumbnail() ) { 
the_post_thumbnail('servicio', array('class' => 'nombre_clase'));
} else { ?>
<img src="http://placehold.it/475x266/" />
<?php } ?>
https://snipt.net/embed/3ffd6aa12d86b30c2bae1e69c77abb65/
/raw/3ffd6aa12d86b30c2bae1e69c77abb65/
3ffd6aa12d86b30c2bae1e69c77abb65
php
PHP
5
2019-06-15T20:23:45
True
False
False
Jul 18, 2013 at 11:14 AM
/api/public/snipt/68410/
asignar-clase-a-thumbnail-wordpress
<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> <a href="#L-5">5</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 class="k">if</span> <span class="p">(</span> <span class="nx">has_post_thumbnail</span><span class="p">()</span> <span class="p">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">the_post_thumbnail</span><span class="p">(</span><span class="s1">&#39;servicio&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;class&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;nombre_clase&#39;</span><span class="p">));</span> </span><span id="L-3"><a name="L-3"></a><span class="p">}</span> <span class="k">else</span> <span class="p">{</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-4"><a name="L-4"></a><span class="x">&lt;img src=&quot;http://placehold.it/475x266/&quot; /&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">&lt;?php</span> <span class="p">}</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
array, thumbnail, wordpress