snipt

Ctrl+h for KB shortcuts

SQL

Exclude all base images from gallery

1
2
3
UPDATE mag_catalog_product_entity_media_gallery_value 
SET disabled = 1 
WHERE position = 1
https://snipt.net/embed/654c489e8fcb2bceb2e10260d6f94c10/
/raw/654c489e8fcb2bceb2e10260d6f94c10/
654c489e8fcb2bceb2e10260d6f94c10
sql
SQL
3
2019-08-23T11:04:58
True
False
False
Jul 21, 2013 at 02:39 AM
/api/public/snipt/68838/
exclude-all-base-images-from-gallery
<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="k">UPDATE</span> <span class="n">mag_catalog_product_entity_media_gallery_value</span> </span><span id="L-2"><a name="L-2"></a><span class="k">SET</span> <span class="n">disabled</span> <span class="o">=</span> <span class="mi">1</span> </span><span id="L-3"><a name="L-3"></a><span class="k">WHERE</span> <span class="k">position</span> <span class="o">=</span> <span class="mi">1</span> </span></pre></div> </td></tr></table>
"base image", exclude, gallery, magento

PHP

Excluir Post en single de un segundo Loop

1
2
3
<?php query_posts( array( 'post_type' => 'slug', 'posts_per_page' => , 
/* la clave */ 'post__not_in' => array( $post->ID )) );
if (have_posts()) : while (have_posts()) : the_post(); ?>
https://snipt.net/embed/cf01c0c5e19fac5c160efe1ebd7fbc8c/
/raw/cf01c0c5e19fac5c160efe1ebd7fbc8c/
cf01c0c5e19fac5c160efe1ebd7fbc8c
php
PHP
3
2019-08-22T23:28:22
True
False
False
/api/public/snipt/42602/
excluir-post-en-single-de-un-segundo-loop
<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="nx">query_posts</span><span class="p">(</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;post_type&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;slug&#39;</span><span class="p">,</span> <span class="s1">&#39;posts_per_page&#39;</span> <span class="o">=&gt;</span> <span class="nx">nº</span><span class="p">,</span> </span><span id="L-2"><a name="L-2"></a><span class="cm">/* la clave */</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">$post</span><span class="o">-&gt;</span><span class="na">ID</span> <span class="p">))</span> <span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="k">if</span> <span class="p">(</span><span class="nx">have_posts</span><span class="p">())</span> <span class="o">:</span> <span class="k">while</span> <span class="p">(</span><span class="nx">have_posts</span><span class="p">())</span> <span class="o">:</span> <span class="nx">the_post</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
exclude, loop, post, wordpress

HTML+PHP

Galeria Wordpress / Gallery wordpress exclude post thumbnail

1
2
3
4
<?php  
$id = get_post_thumbnail_id(get_the_ID()); // gets the post thumbnail ID 
echo do_shortcode('[gallery exclude='.$id.' link="file" itemtag="ul" icontag="li" columns="4" size="galeria"]'); 
?>
https://snipt.net/embed/ba0005f21b3d3537f983c9dbad387d85/
/raw/ba0005f21b3d3537f983c9dbad387d85/
ba0005f21b3d3537f983c9dbad387d85
html+php
HTML+PHP
4
2019-08-21T20:26:06
True
False
False
/api/public/snipt/42206/
galeria-wordpress-gallery-wordpress-exclude-post-thumbnail
<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">$id</span> <span class="o">=</span> <span class="nx">get_post_thumbnail_id</span><span class="p">(</span><span class="nx">get_the_ID</span><span class="p">());</span> <span class="c1">// gets the post thumbnail ID </span> </span><span id="L-3"><a name="L-3"></a><span class="k">echo</span> <span class="nx">do_shortcode</span><span class="p">(</span><span class="s1">&#39;[gallery exclude=&#39;</span><span class="o">.</span><span class="nv">$id</span><span class="o">.</span><span class="s1">&#39; link=&quot;file&quot; itemtag=&quot;ul&quot; icontag=&quot;li&quot; columns=&quot;4&quot; size=&quot;galeria&quot;]&#39;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="cp">?&gt;</span> </span></pre></div> </td></tr></table>
exclude, gallery, thumbnail, wordpress

Bash

tar a folder excluding svn metadata

tar cvf sdk.tar --exclude=\.svn sdk/
https://snipt.net/embed/73663da644ac50233be55f708ed8d14e/
/raw/73663da644ac50233be55f708ed8d14e/
73663da644ac50233be55f708ed8d14e
bash
Bash
1
2019-08-22T19:19:22
True
False
False
/api/public/snipt/7248/
tar-a-folder-excluding-svn-metadata
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>tar cvf sdk.tar --exclude<span class="o">=</span><span class="se">\.</span>svn sdk/ </span></pre></div> </td></tr></table>
bash, exclude, metadata, svn, tar