snipt

Ctrl+h for KB shortcuts

Text only

Exclure des catégories de la boucle WordPress

1
2
3
4
5
6
7
8
// Exclude category from home
function myFilter($query) {
    if ($query->is_home) {
        $query->set('category__not_in',array(39,10));
    }
return $query;
}
add_filter('pre_get_posts','myFilter');
https://snipt.net/embed/0de371cb05aea4c74ba19d33276ee386/
/raw/0de371cb05aea4c74ba19d33276ee386/
0de371cb05aea4c74ba19d33276ee386
text
Text only
8
2019-08-17T21:22:21
True
False
False
/api/public/snipt/50391/
exclure-des-categories-de-la-boucle-word-press
<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> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>// Exclude category from home </span><span id="L-2"><a name="L-2"></a>function myFilter($query) { </span><span id="L-3"><a name="L-3"></a> if ($query-&gt;is_home) { </span><span id="L-4"><a name="L-4"></a> $query-&gt;set(&#39;category__not_in&#39;,array(39,10)); </span><span id="L-5"><a name="L-5"></a> } </span><span id="L-6"><a name="L-6"></a>return $query; </span><span id="L-7"><a name="L-7"></a>} </span><span id="L-8"><a name="L-8"></a>add_filter(&#39;pre_get_posts&#39;,&#39;myFilter&#39;); </span></pre></div> </td></tr></table>
php, wordpress

Text only

Utiliser les shortcodes dans les widgets

1
2
3
if ( !is_admin() ) {
    add_filter('widget_text', 'do_shortcode', 11);
}
https://snipt.net/embed/5c047ed47135dd6e32e3f627be073e49/
/raw/5c047ed47135dd6e32e3f627be073e49/
5c047ed47135dd6e32e3f627be073e49
text
Text only
3
2019-08-17T21:15:00
True
False
False
Nov 13, 2012 at 04:29 PM
/api/public/snipt/49218/
utiliser-les-shortcodes-dans-les-widgets
<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>if ( !is_admin() ) { </span><span id="L-2"><a name="L-2"></a> add_filter(&#39;widget_text&#39;, &#39;do_shortcode&#39;, 11); </span><span id="L-3"><a name="L-3"></a>} </span></pre></div> </td></tr></table>
php, wordpress

Text only

Lien pour imprimer la page

<a href="javascript:window.print()">imprimer la page</a>
https://snipt.net/embed/9c5a2d1a2915780cf089041e191ce906/
/raw/9c5a2d1a2915780cf089041e191ce906/
9c5a2d1a2915780cf089041e191ce906
text
Text only
1
2019-08-17T20:29:47
True
False
False
Oct 28, 2012 at 05:06 PM
/api/public/snipt/49217/
lien-pour-imprimer-la-page
<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>&lt;a href=&quot;javascript:window.print()&quot;&gt;imprimer la page&lt;/a&gt; </span></pre></div> </td></tr></table>
html, js

JavaScript

Script de traduction Google

javascript:var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.fr/?text='+t+'&hl=fr&langpair=auto|fr&tbb=1&ie='+e;}else{location.href='http://translate.google.fr/translate?u='+encodeURIComponent(location.href)+'&hl=fr&langpair=auto|fr&tbb=1&ie='+e;};
https://snipt.net/embed/a7fd5c392dbb53b601dce2e5e2994356/
/raw/a7fd5c392dbb53b601dce2e5e2994356/
a7fd5c392dbb53b601dce2e5e2994356
js
JavaScript
1
2016-12-28T01:38:58
True
False
True
Sep 19, 2012 at 06:32 AM
/api/public/snipt/47354/
script-de-traduction-google
<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><span class="nx">javascript</span><span class="o">:</span><span class="kd">var</span><span class="o">%</span><span class="mi">20</span><span class="nx">t</span><span class="o">=</span><span class="p">((</span><span class="nb">window</span><span class="p">.</span><span class="nx">getSelection</span><span class="o">&amp;&amp;</span><span class="nb">window</span><span class="p">.</span><span class="nx">getSelection</span><span class="p">())</span><span class="o">||</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">getSelection</span><span class="o">&amp;&amp;</span><span class="nb">document</span><span class="p">.</span><span class="nx">getSelection</span><span class="p">())</span><span class="o">||</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">selection</span><span class="o">&amp;&amp;</span><span class="nb">document</span><span class="p">.</span><span class="nx">selection</span><span class="p">.</span><span class="nx">createRange</span><span class="o">&amp;&amp;</span><span class="nb">document</span><span class="p">.</span><span class="nx">selection</span><span class="p">.</span><span class="nx">createRange</span><span class="p">().</span><span class="nx">text</span><span class="p">));</span><span class="kd">var</span><span class="o">%</span><span class="mi">20</span><span class="nx">e</span><span class="o">=</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">charset</span><span class="o">||</span><span class="nb">document</span><span class="p">.</span><span class="nx">characterSet</span><span class="p">);</span><span class="k">if</span><span class="p">(</span><span class="nx">t</span><span class="o">!=</span><span class="s1">&#39;&#39;</span><span class="p">){</span><span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="o">=</span><span class="s1">&#39;http://translate.google.fr/?text=&#39;</span><span class="o">+</span><span class="nx">t</span><span class="o">+</span><span class="s1">&#39;&amp;hl=fr&amp;langpair=auto|fr&amp;tbb=1&amp;ie=&#39;</span><span class="o">+</span><span class="nx">e</span><span class="p">;}</span><span class="k">else</span><span class="p">{</span><span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="o">=</span><span class="s1">&#39;http://translate.google.fr/translate?u=&#39;</span><span class="o">+</span><span class="nb">encodeURIComponent</span><span class="p">(</span><span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="p">)</span><span class="o">+</span><span class="s1">&#39;&amp;hl=fr&amp;langpair=auto|fr&amp;tbb=1&amp;ie=&#39;</span><span class="o">+</span><span class="nx">e</span><span class="p">;};</span> </span></pre></div> </td></tr></table>
js

Text only

flexiblevidéowrapper

1
2
3
4
5
<div class="video-wrapper">
<div class="video-container">
<iframe src="http://www.dailymotion.com/embed/video/xnhtlb"></iframe>
</div>
</div>
https://snipt.net/embed/8e2836051cda4f18ebfd2858285a1107/
/raw/8e2836051cda4f18ebfd2858285a1107/
8e2836051cda4f18ebfd2858285a1107
text
Text only
5
2019-08-18T15:34:42
True
False
False
Oct 28, 2012 at 05:32 PM
/api/public/snipt/42458/
flexiblevideowrapper
<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>&lt;div class=&quot;video-wrapper&quot;&gt; </span><span id="L-2"><a name="L-2"></a>&lt;div class=&quot;video-container&quot;&gt; </span><span id="L-3"><a name="L-3"></a>&lt;iframe src=&quot;http://www.dailymotion.com/embed/video/xnhtlb&quot;&gt;&lt;/iframe&gt; </span><span id="L-4"><a name="L-4"></a>&lt;/div&gt; </span><span id="L-5"><a name="L-5"></a>&lt;/div&gt; </span></pre></div> </td></tr></table>
html

Text only

flexiblevidéo3

1
2
3
4
.video-wrapper {
    width: 600px;
	max-width: 100%;
}
https://snipt.net/embed/bc07cecc650a30f689ab06698f1a7f3c/
/raw/bc07cecc650a30f689ab06698f1a7f3c/
bc07cecc650a30f689ab06698f1a7f3c
text
Text only
4
2019-08-17T21:16:01
True
False
False
Oct 28, 2012 at 05:32 PM
/api/public/snipt/42457/
flexiblevideo3
<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>.video-wrapper { </span><span id="L-2"><a name="L-2"></a> width: 600px; </span><span id="L-3"><a name="L-3"></a> max-width: 100%; </span><span id="L-4"><a name="L-4"></a>} </span></pre></div> </td></tr></table>
css

Text only

flexiblevidéo

1
2
3
<div class="video-container">
<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/xnhtlb"></iframe>
</div>
https://snipt.net/embed/c44d2326de1b2bfb1e264a8215ecbb5d/
/raw/c44d2326de1b2bfb1e264a8215ecbb5d/
c44d2326de1b2bfb1e264a8215ecbb5d
text
Text only
3
2019-08-17T09:39:46
True
False
False
Oct 28, 2012 at 05:32 PM
/api/public/snipt/42452/
flexiblevideo
<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>&lt;div class=&quot;video-container&quot;&gt; </span><span id="L-2"><a name="L-2"></a>&lt;iframe frameborder=&quot;0&quot; width=&quot;480&quot; height=&quot;270&quot; src=&quot;http://www.dailymotion.com/embed/video/xnhtlb&quot;&gt;&lt;/iframe&gt; </span><span id="L-3"><a name="L-3"></a>&lt;/div&gt; </span></pre></div> </td></tr></table>
html