snipt

Ctrl+h for KB shortcuts

PHP

WordPress Shortcode to insert iDevCenter Rank. (more efficient one)

1
2
3
4
5
6
7
function idcRankHandler(){ 
	$url = rawurlencode(get_permalink($post->ID)); 
	return '<a href="http://idevcenter.com/links/vote?url='. $url .'" class="idcRankAnchor">'
			.'<img src="http://idevcenter.com/links/image?url='.$url
			.'" title="Vote on iDevCenter.com" alt="Vote on iDevCenter.com" class="idcRankImage" />
		</a>';
} add_shortcode("idc","idcRankHandler"); //Attaching iDC handler
https://snipt.net/embed/0bdcd99681bbe7c9dff1734e500c2c01/
/raw/0bdcd99681bbe7c9dff1734e500c2c01/
0bdcd99681bbe7c9dff1734e500c2c01
php
PHP
7
2019-08-22T09:00:20
True
False
False
/api/public/snipt/2613/
wordpress-shortcode-to-insert-idevcenter-rank-more-efficient-one
<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="x">function idcRankHandler(){ </span> </span><span id="L-2"><a name="L-2"></a><span class="x"> $url = rawurlencode(get_permalink($post-&gt;ID)); </span> </span><span id="L-3"><a name="L-3"></a><span class="x"> return &#39;&lt;a href=&quot;http://idevcenter.com/links/vote?url=&#39;. $url .&#39;&quot; class=&quot;idcRankAnchor&quot;&gt;&#39;</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> .&#39;&lt;img src=&quot;http://idevcenter.com/links/image?url=&#39;.$url</span> </span><span id="L-5"><a name="L-5"></a><span class="x"> .&#39;&quot; title=&quot;Vote on iDevCenter.com&quot; alt=&quot;Vote on iDevCenter.com&quot; class=&quot;idcRankImage&quot; /&gt;</span> </span><span id="L-6"><a name="L-6"></a><span class="x"> &lt;/a&gt;&#39;;</span> </span><span id="L-7"><a name="L-7"></a><span class="x">} add_shortcode(&quot;idc&quot;,&quot;idcRankHandler&quot;); //Attaching iDC handler</span> </span></pre></div> </td></tr></table>
idevcenter, php, shortcode, wordpress

PHP

Conditional Tags

1
2
3
<?php if ( ( is_home() ) ) { ?>
<?php } else { ?>
<?php } ?>
https://snipt.net/embed/3459ab424681961ad9f3ac766191a4d2/
/raw/3459ab424681961ad9f3ac766191a4d2/
3459ab424681961ad9f3ac766191a4d2
php
PHP
4
2019-08-22T09:01:33
True
False
False
/api/public/snipt/2406/
conditional-tags
<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="k">if</span> <span class="p">(</span> <span class="p">(</span> <span class="nx">is_home</span><span class="p">()</span> <span class="p">)</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="p">}</span> <span class="k">else</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="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
conditional, wordpress

HTML+PHP

Share on Facebook

<a href="http://www.facebook.com/share.php?u=<?php echo get_permalink() ?>" title="Share on Facebook" target="_blank">Share on Facebook</a>
https://snipt.net/embed/5d2c8c1b7cfe50aefc75ec33a32ac6c1/
/raw/5d2c8c1b7cfe50aefc75ec33a32ac6c1/
5d2c8c1b7cfe50aefc75ec33a32ac6c1
html+php
HTML+PHP
1
2019-08-22T09:02:20
True
False
False
/api/public/snipt/1947/
share-on-facebook
<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">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;http://www.facebook.com/share.php?u=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">get_permalink</span><span class="p">()</span> <span class="cp">?&gt;</span><span class="s">&quot;</span> <span class="na">title</span><span class="o">=</span><span class="s">&quot;Share on Facebook&quot;</span> <span class="na">target</span><span class="o">=</span><span class="s">&quot;_blank&quot;</span><span class="p">&gt;</span>Share on Facebook<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
facebook, social, wordpress

HTML+PHP

Share on Stumble Upon

<a href="http://www.stumbleupon.com/submit?url=<?php echo get_permalink() ?>&title=<?php the_title(); ?>" title="Stumble This" target="_blank">Stumble This</a> 
https://snipt.net/embed/12a7cc6c7f435f688a088f5a30560212/
/raw/12a7cc6c7f435f688a088f5a30560212/
12a7cc6c7f435f688a088f5a30560212
html+php
HTML+PHP
1
2019-08-22T09:02:53
True
False
False
/api/public/snipt/1946/
share-on-stumble-upon
<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">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;http://www.stumbleupon.com/submit?url=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">get_permalink</span><span class="p">()</span> <span class="cp">?&gt;</span><span class="s">&amp;title=</span><span class="cp">&lt;?php</span> <span class="nx">the_title</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="s">&quot;</span> <span class="na">title</span><span class="o">=</span><span class="s">&quot;Stumble This&quot;</span> <span class="na">target</span><span class="o">=</span><span class="s">&quot;_blank&quot;</span><span class="p">&gt;</span>Stumble This<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
social, stumbleupon, wordpress

HTML+PHP

Share on Digg

<a href="http://digg.com/submit?phase=2&url=<?php echo get_permalink() ?>&title=<?php the_title(); ?>" title="Digg This" target="_blank">Digg This</a>
https://snipt.net/embed/a63dccb3ffd842624b88008504592a45/
/raw/a63dccb3ffd842624b88008504592a45/
a63dccb3ffd842624b88008504592a45
html+php
HTML+PHP
1
2019-08-22T11:39:28
True
False
False
/api/public/snipt/1944/
share-on-digg
<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">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;http://digg.com/submit?phase=2&amp;url=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">get_permalink</span><span class="p">()</span> <span class="cp">?&gt;</span><span class="s">&amp;title=</span><span class="cp">&lt;?php</span> <span class="nx">the_title</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="s">&quot;</span> <span class="na">title</span><span class="o">=</span><span class="s">&quot;Digg This&quot;</span> <span class="na">target</span><span class="o">=</span><span class="s">&quot;_blank&quot;</span><span class="p">&gt;</span>Digg This<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
digg, social, wordpress

HTML+PHP

Share on Delicious

<a href="http://del.icio.us/post?url=<?php echo get_permalink() ?>&title=<?php the_title(); ?>" title="Click to bookmark this page on Delicious" target="_blank">Bookmark on Delicious</a>
https://snipt.net/embed/5411160bd8e8d67aeb6a9bd79e083393/
/raw/5411160bd8e8d67aeb6a9bd79e083393/
5411160bd8e8d67aeb6a9bd79e083393
html+php
HTML+PHP
1
2019-08-22T09:04:02
True
False
False
/api/public/snipt/1943/
share-on-delicious
<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">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;http://del.icio.us/post?url=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">get_permalink</span><span class="p">()</span> <span class="cp">?&gt;</span><span class="s">&amp;title=</span><span class="cp">&lt;?php</span> <span class="nx">the_title</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="s">&quot;</span> <span class="na">title</span><span class="o">=</span><span class="s">&quot;Click to bookmark this page on Delicious&quot;</span> <span class="na">target</span><span class="o">=</span><span class="s">&quot;_blank&quot;</span><span class="p">&gt;</span>Bookmark on Delicious<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
delicious, social, wordpress