snipt

Ctrl+h for KB shortcuts

PHP

Register De-Register jQuery in Wordpress

wp_deregister_script('jquery');
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', false, null, false);
https://snipt.net/embed/c99595274f18e0825e4eb1757994e5c6/
/raw/c99595274f18e0825e4eb1757994e5c6/
c99595274f18e0825e4eb1757994e5c6
php
PHP
2
2019-08-20T04:17:51
True
False
False
Mar 25, 2014 at 08:13 AM
/api/public/snipt/124607/
register-de-register-jquery-in-wordpress
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">wp_deregister_script(&#39;jquery&#39;);</span> </span><span id="L-2"><a name="L-2"></a><span class="x">wp_register_script(&#39;jquery&#39;, &#39;//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js&#39;, false, null, false);</span> </span></pre></div> </td></tr></table>
"Register jQuery", Wordpress

JavaScript

Fix broken images automatically

1
2
3
$('img').error(function(){
	$(this).attr('src', img/broken.png);
});
https://snipt.net/embed/2bfa40e8fcee9dbd650cb1a9b2734eff/
/raw/2bfa40e8fcee9dbd650cb1a9b2734eff/
2bfa40e8fcee9dbd650cb1a9b2734eff
js
JavaScript
3
2019-08-19T22:59:50
True
False
False
Feb 11, 2014 at 02:17 AM
/api/public/snipt/112591/
fix-broken-images-automatically-1
<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="nx">$</span><span class="p">(</span><span class="s1">&#39;img&#39;</span><span class="p">).</span><span class="nx">error</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;src&#39;</span><span class="p">,</span> <span class="err">‘</span><span class="nx">img</span><span class="o">/</span><span class="nx">broken</span><span class="p">.</span><span class="nx">png</span><span class="err">’</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
images, javascript