snipt

Ctrl+h for KB shortcuts

PHP

Wordpress PHP add social bar to loop

// bookmark on Delicious
<a rel="nofollow" href="http://delicious.com/post?url=<?php the_permalink(); ?>&amp;title=<?php echo urlencode(get_the_title($id)); ?>" title="Bookmark this post at Delicious">Bookmark at Delicious</a>

// submit to Digg
<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=<?php the_permalink(); ?>" title="Submit this post to Digg">Digg this!</a>

// tweet on Twitter
<a rel="nofollow" href="http://twitter.com/home?status=<?php echo urlencode("Currently reading: "); ?><?php the_permalink(); ?>" title="Share this article with your Twitter followers">Tweet this!</a>

// submit to StumbleUpon
<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post at StumbleUpon">Stumble this!</a>

// share on Facebook
<a rel="nofollow" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post on Facebook">Share on Facebook</a>

// submit to Blinklist
<a rel="nofollow" href="http://blinklist.com/index.php?Action=Blink/addblink.php&amp;url=<?php the_permalink(); ?>&amp;Title=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post on Blinklist" >Blink This!</a>

// store on Furl
<a rel="nofollow" href="http://furl.net/storeIt.jsp?t=<?php echo urlencode(get_the_title($id)); ?>&amp;u=<?php the_permalink(); ?>" title="Share this post on Furl">Furl This!</a>

// submit to Reddit
<a rel="nofollow" href="http://reddit.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php echo urlencode(get_the_title($id)); ?>" title="Share this post on Reddit">Share on Reddit</a>
https://snipt.net/embed/0ea9e6b63283c1909b95089325d12324/
/raw/0ea9e6b63283c1909b95089325d12324/
0ea9e6b63283c1909b95089325d12324
php
PHP
23
2019-07-21T05:44:23
True
False
False
Aug 28, 2012 at 06:40 AM
/api/public/snipt/46369/
wordpress-php-add-social-bar-to-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> <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> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a> <a href="#L-12">12</a> <a href="#L-13">13</a> <a href="#L-14">14</a> <a href="#L-15">15</a> <a href="#L-16">16</a> <a href="#L-17">17</a> <a href="#L-18">18</a> <a href="#L-19">19</a> <a href="#L-20">20</a> <a href="#L-21">21</a> <a href="#L-22">22</a> <a href="#L-23">23</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">// bookmark on Delicious</span> </span><span id="L-2"><a name="L-2"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://delicious.com/post?url=</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&amp;amp;title=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">urlencode</span><span class="p">(</span><span class="nx">get_the_title</span><span class="p">(</span><span class="nv">$id</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Bookmark this post at Delicious&quot;&gt;Bookmark at Delicious&lt;/a&gt;</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="x">// submit to Digg</span> </span><span id="L-5"><a name="L-5"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://digg.com/submit?phase=2&amp;amp;url=</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Submit this post to Digg&quot;&gt;Digg this!&lt;/a&gt;</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="x">// tweet on Twitter</span> </span><span id="L-8"><a name="L-8"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://twitter.com/home?status=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">urlencode</span><span class="p">(</span><span class="s2">&quot;Currently reading: &quot;</span><span class="p">);</span> <span class="cp">?&gt;&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Share this article with your Twitter followers&quot;&gt;Tweet this!&lt;/a&gt;</span> </span><span id="L-9"><a name="L-9"></a> </span><span id="L-10"><a name="L-10"></a><span class="x">// submit to StumbleUpon</span> </span><span id="L-11"><a name="L-11"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://www.stumbleupon.com/submit?url=</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&amp;amp;title=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">urlencode</span><span class="p">(</span><span class="nx">get_the_title</span><span class="p">(</span><span class="nv">$id</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Share this post at StumbleUpon&quot;&gt;Stumble this!&lt;/a&gt;</span> </span><span id="L-12"><a name="L-12"></a> </span><span id="L-13"><a name="L-13"></a><span class="x">// share on Facebook</span> </span><span id="L-14"><a name="L-14"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://www.facebook.com/sharer.php?u=</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span><span class="cp">?&gt;</span><span class="x">&amp;amp;t=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">urlencode</span><span class="p">(</span><span class="nx">get_the_title</span><span class="p">(</span><span class="nv">$id</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Share this post on Facebook&quot;&gt;Share on Facebook&lt;/a&gt;</span> </span><span id="L-15"><a name="L-15"></a> </span><span id="L-16"><a name="L-16"></a><span class="x">// submit to Blinklist</span> </span><span id="L-17"><a name="L-17"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://blinklist.com/index.php?Action=Blink/addblink.php&amp;amp;url=</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&amp;amp;Title=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">urlencode</span><span class="p">(</span><span class="nx">get_the_title</span><span class="p">(</span><span class="nv">$id</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Share this post on Blinklist&quot; &gt;Blink This!&lt;/a&gt;</span> </span><span id="L-18"><a name="L-18"></a> </span><span id="L-19"><a name="L-19"></a><span class="x">// store on Furl</span> </span><span id="L-20"><a name="L-20"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://furl.net/storeIt.jsp?t=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">urlencode</span><span class="p">(</span><span class="nx">get_the_title</span><span class="p">(</span><span class="nv">$id</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x">&amp;amp;u=</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Share this post on Furl&quot;&gt;Furl This!&lt;/a&gt;</span> </span><span id="L-21"><a name="L-21"></a> </span><span id="L-22"><a name="L-22"></a><span class="x">// submit to Reddit</span> </span><span id="L-23"><a name="L-23"></a><span class="x">&lt;a rel=&quot;nofollow&quot; href=&quot;http://reddit.com/submit?url=</span><span class="cp">&lt;?php</span> <span class="nx">the_permalink</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x">&amp;amp;title=</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">urlencode</span><span class="p">(</span><span class="nx">get_the_title</span><span class="p">(</span><span class="nv">$id</span><span class="p">));</span> <span class="cp">?&gt;</span><span class="x">&quot; title=&quot;Share this post on Reddit&quot;&gt;Share on Reddit&lt;/a&gt;</span> </span></pre></div> </td></tr></table>
loop, php, social, wordpress