Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PHP

Add favicon and touch icon to header

1
2
3
4
5
6
<?php
function add_favicons() {
    echo '<link rel="shortcut icon" href="' . get_stylesheet_directory_uri() . '/images/favicon.ico">'."\n";
    echo '<link rel="apple-touch-icon-precomposed" href="' . get_stylesheet_directory_uri() . '/images/apple-touch-icon-precomposed.png" />'."\n";
}
add_action('wp_head', 'add_favicons');
https://snipt.net/embed/fe907fad4fc7abb68ca175b0c5131702/
https://snipt.net/raw/fe907fad4fc7abb68ca175b0c5131702/
fe907fad4fc7abb68ca175b0c5131702
php
PHP
6
2016-12-02T15:18:21
True
False
False
Feb 16, 2016 at 11:49 AM
/api/public/snipt/144250/
add-favicon-and-touch-icon-to-header
<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></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="k">function</span> <span class="nf">add_favicons</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">echo</span> <span class="s1">&#39;&lt;link rel=&quot;shortcut icon&quot; href=&quot;&#39;</span> <span class="o">.</span> <span class="nx">get_stylesheet_directory_uri</span><span class="p">()</span> <span class="o">.</span> <span class="s1">&#39;/images/favicon.ico&quot;&gt;&#39;</span><span class="o">.</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">echo</span> <span class="s1">&#39;&lt;link rel=&quot;apple-touch-icon-precomposed&quot; href=&quot;&#39;</span> <span class="o">.</span> <span class="nx">get_stylesheet_directory_uri</span><span class="p">()</span> <span class="o">.</span> <span class="s1">&#39;/images/apple-touch-icon-precomposed.png&quot; /&gt;&#39;</span><span class="o">.</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a><span class="p">}</span> </span><span id="L-6"><a name="L-6"></a><span class="nx">add_action</span><span class="p">(</span><span class="s1">&#39;wp_head&#39;</span><span class="p">,</span> <span class="s1">&#39;add_favicons&#39;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
favicon, wordpress

HTML

The new favicon

1
2
3
4
5
6
7
<!-- From http://www.jonathantneal.com/blog/understand-the-favicon/ -->
<link rel="apple-touch-icon" href="path/to/touchicon.png">
<link rel="icon" href="path/to/favicon.png">
<!--[if IE]><link rel="shortcut icon" href="path/to/favicon.ico"><![endif]-->
<!-- or, set /favicon.ico for IE10 win -->
<meta name="msapplication-TileColor" content="#D83434">
<meta name="msapplication-TileImage" content="path/to/tileicon.png">
https://snipt.net/embed/8d8e71d05098a01840da01999d8a86ff/
https://snipt.net/raw/8d8e71d05098a01840da01999d8a86ff/
8d8e71d05098a01840da01999d8a86ff
html
HTML
7
2016-11-25T11:45:54
True
False
False
Jan 29, 2013 at 10:46 AM
/api/public/snipt/54719/
the-new-favicon
<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="c">&lt;!-- From http://www.jonathantneal.com/blog/understand-the-favicon/ --&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;apple-touch-icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;path/to/touchicon.png&quot;</span><span class="p">&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;path/to/favicon.png&quot;</span><span class="p">&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="c">&lt;!--[if IE]&gt;&lt;link rel=&quot;shortcut icon&quot; href=&quot;path/to/favicon.ico&quot;&gt;&lt;![endif]--&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="c">&lt;!-- or, set /favicon.ico for IE10 win --&gt;</span> </span><span id="L-6"><a name="L-6"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;msapplication-TileColor&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;#D83434&quot;</span><span class="p">&gt;</span> </span><span id="L-7"><a name="L-7"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;msapplication-TileImage&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;path/to/tileicon.png&quot;</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
favicon

HTML+PHP

Add favicon to WordPress

<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/favicon.ico" />
https://snipt.net/embed/62045bbbac6326b4645527ed540d76a6/
https://snipt.net/raw/62045bbbac6326b4645527ed540d76a6/
62045bbbac6326b4645527ed540d76a6
html+php
HTML+PHP
1
2016-12-05T02:52:31
True
False
False
/api/public/snipt/41948/
add-favicon-to-wordpress
<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="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;shortcut icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">get_template_directory_uri</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="s">/favicon.ico&quot;</span> <span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
favicon, wordpress

HTML

favicon

<!-- Favicon -->
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
https://snipt.net/embed/de8137eb669e44121f2e5def5dffc73c/
https://snipt.net/raw/de8137eb669e44121f2e5def5dffc73c/
de8137eb669e44121f2e5def5dffc73c
html
HTML
2
2016-11-25T11:45:47
True
False
False
/api/public/snipt/16170/
favicon-7
<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="c">&lt;!-- Favicon --&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;shortcut icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/favicon.ico&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;image/x-icon&quot;</span> <span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
favicon

HTML

Iphone icon

1
2
3
4
5
6
7
<!--
PNG
57px * 57px
No rounded corners
-->

<link rel="apple-touch-icon" href="/customIcon.png"/>
https://snipt.net/embed/0a31676fb220b4c8c8fbe658d1f4a16a/
https://snipt.net/raw/0a31676fb220b4c8c8fbe658d1f4a16a/
0a31676fb220b4c8c8fbe658d1f4a16a
html
HTML
7
2016-11-29T22:01:09
True
False
False
/api/public/snipt/15939/
iphone-icon
<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="c">&lt;!--</span> </span><span id="L-2"><a name="L-2"></a><span class="c">PNG</span> </span><span id="L-3"><a name="L-3"></a><span class="c">57px * 57px</span> </span><span id="L-4"><a name="L-4"></a><span class="c">No rounded corners</span> </span><span id="L-5"><a name="L-5"></a><span class="c">--&gt;</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;apple-touch-icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/customIcon.png&quot;</span><span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
favicon, html

ApacheConf

servindo favicon pelo apache. Config do htaccess

RewriteRule ^favicon\.ico$ /media/images/favicon.ico [L]
https://snipt.net/embed/0fa84d2f4d395b7456db449a7ec3c389/
https://snipt.net/raw/0fa84d2f4d395b7456db449a7ec3c389/
0fa84d2f4d395b7456db449a7ec3c389
apacheconf
ApacheConf
1
2016-12-04T16:41:53
True
False
False
/api/public/snipt/14738/
servindo-favicon-pelo-apache-config-do-htaccess
<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="nb">RewriteRule</span> ^favicon\.ico$ <span class="sx">/media/images/favicon.ico</span> [L] </span></pre></div> </td></tr></table>
apache, favicon

HTML

Include Favicon

<link rel="shortcut icon" href="favicon.ico" />
https://snipt.net/embed/c66d4cfb371f0bda721baed025e21364/
https://snipt.net/raw/c66d4cfb371f0bda721baed025e21364/
c66d4cfb371f0bda721baed025e21364
html
HTML
1
2016-12-05T09:53:01
True
False
False
/api/public/snipt/2762/
include-favicon
<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="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;shortcut icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;favicon.ico&quot;</span> <span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
favicon, html

HTML

Favicon

1
2
3
4
<link rel="icon" type="image/png" href="myicon.png" />
	<!--[if IE]>
	<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="myicon.ico" />
	<![endif]-->
https://snipt.net/embed/7751d48df8affa0ec7c8c4f7f50b54cf/
https://snipt.net/raw/7751d48df8affa0ec7c8c4f7f50b54cf/
7751d48df8affa0ec7c8c4f7f50b54cf
html
HTML
5
2016-12-02T09:16:27
True
False
False
/api/public/snipt/1952/
favicon-2
<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="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;icon&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;image/png&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;myicon.png&quot;</span> <span class="p">/&gt;</span> </span><span id="L-2"><a name="L-2"></a> <span class="c">&lt;!--[if IE]&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="c"> &lt;link rel=&quot;shortcut icon&quot; type=&quot;image/vnd.microsoft.icon&quot; href=&quot;myicon.ico&quot; /&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="c"> &lt;![endif]--&gt;</span> </span></pre></div> </td></tr></table>
favicon, html

HTML

Favicon

1
2
3
4
5
6
7
<head profile="http://www.w3.org/2005/10/profile">
	<!-- Some code here -->
	<link rel="icon" type="image/png" href="myicon.png" />
	<!--[if IE]>
	<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="myicon.ico" />
	<![endif]-->
</head>
https://snipt.net/embed/204a401986f227226d72b7c12303b601/
https://snipt.net/raw/204a401986f227226d72b7c12303b601/
204a401986f227226d72b7c12303b601
html
HTML
7
2016-12-02T09:16:42
True
False
False
/api/public/snipt/1442/
favicon-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> <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="p">&lt;</span><span class="nt">head</span> <span class="na">profile</span><span class="o">=</span><span class="s">&quot;http://www.w3.org/2005/10/profile&quot;</span><span class="p">&gt;</span> </span><span id="L-2"><a name="L-2"></a> <span class="c">&lt;!-- Some code here --&gt;</span> </span><span id="L-3"><a name="L-3"></a> <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;icon&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;image/png&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;myicon.png&quot;</span> <span class="p">/&gt;</span> </span><span id="L-4"><a name="L-4"></a> <span class="c">&lt;!--[if IE]&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="c"> &lt;link rel=&quot;shortcut icon&quot; type=&quot;image/vnd.microsoft.icon&quot; href=&quot;myicon.ico&quot; /&gt;</span> </span><span id="L-6"><a name="L-6"></a><span class="c"> &lt;![endif]--&gt;</span> </span><span id="L-7"><a name="L-7"></a><span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
favicon, html
Copyrighted, illegal, or inappropriate content? Email [email protected].