snipt

Ctrl+h for KB shortcuts

PHP

Show (@twitterusername) in wordpress if its entered

1
2
3
4
5
6
7
function display_Twitter(){
if (get_the_author_meta('twitter') == NULL) {
}
else {
echo '(<a href="https://twitter.com/' . get_the_author_meta('twitter') .'">@' .get_the_author_meta('twitter') . '</a>)';
}
}
https://snipt.net/embed/5ce8368da3b138997dd00a6572d637e8/
/raw/5ce8368da3b138997dd00a6572d637e8/
5ce8368da3b138997dd00a6572d637e8
php
PHP
7
2019-07-02T06:32:41
True
False
False
/api/public/snipt/35484/
show-twitterusername-in-wordpress-if-its-entered
<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 display_Twitter(){</span> </span><span id="L-2"><a name="L-2"></a><span class="x">if (get_the_author_meta(&#39;twitter&#39;) == NULL) {</span> </span><span id="L-3"><a name="L-3"></a><span class="x">}</span> </span><span id="L-4"><a name="L-4"></a><span class="x">else {</span> </span><span id="L-5"><a name="L-5"></a><span class="x">echo &#39;(&lt;a href=&quot;https://twitter.com/&#39; . get_the_author_meta(&#39;twitter&#39;) .&#39;&quot;&gt;@&#39; .get_the_author_meta(&#39;twitter&#39;) . &#39;&lt;/a&gt;)&#39;;</span> </span><span id="L-6"><a name="L-6"></a><span class="x">}</span> </span><span id="L-7"><a name="L-7"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
php, twitter, wordpress

JavaScript

Display your latest tweet without a plugin

1
2
3
4
<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&count=1"></script>

<div id="twitter_div"><ul id="twitter_update_list"><li>&nbsp;</li></ul></div>
https://snipt.net/embed/774ff2982eb6738243f8f2de4885fcf6/
/raw/774ff2982eb6738243f8f2de4885fcf6/
774ff2982eb6738243f8f2de4885fcf6
js
JavaScript
4
2019-07-12T14:41:10
True
False
False
/api/public/snipt/32583/
display-your-latest-tweet-without-a-plugin
<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="o">&lt;</span><span class="nx">script</span> <span class="nx">type</span><span class="o">=</span><span class="s2">&quot;text/javascript&quot;</span> <span class="nx">src</span><span class="o">=</span><span class="s2">&quot;http://twitter.com/javascripts/blogger.js&quot;</span><span class="o">&gt;&lt;</span><span class="err">/script&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="o">&lt;</span><span class="nx">script</span> <span class="nx">type</span><span class="o">=</span><span class="s2">&quot;text/javascript&quot;</span> <span class="nx">src</span><span class="o">=</span><span class="s2">&quot;http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&amp;count=1&quot;</span><span class="o">&gt;&lt;</span><span class="err">/script&gt;</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="o">&lt;</span><span class="nx">div</span> <span class="nx">id</span><span class="o">=</span><span class="s2">&quot;twitter_div&quot;</span><span class="o">&gt;&lt;</span><span class="nx">ul</span> <span class="nx">id</span><span class="o">=</span><span class="s2">&quot;twitter_update_list&quot;</span><span class="o">&gt;&lt;</span><span class="nx">li</span><span class="o">&gt;&amp;</span><span class="nx">nbsp</span><span class="p">;</span><span class="o">&lt;</span><span class="err">/li&gt;&lt;/ul&gt;&lt;/div&gt;</span> </span></pre></div> </td></tr></table>
"twitter latest post", javascript, twitter

HTML

Add FB Like, Tweet, and Google+ URLS

1
2
3
4
5
6
7
8
/*facebook like button*/
http://developers.facebook.com/docs/reference/plugins/like/

/*twitter*/
http://twitter.com/about/resources/tweetbutton

/*google plus 1*/
http://www.google.com/webmasters/+1/button/index.html
https://snipt.net/embed/60e5ffed7051be9b69ac5ec5452fdc0b/
/raw/60e5ffed7051be9b69ac5ec5452fdc0b/
60e5ffed7051be9b69ac5ec5452fdc0b
html
HTML
8
2019-07-08T05:53:45
True
False
False
/api/public/snipt/28456/
add-fb-like-tweet-and-google-urls
<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>/*facebook like button*/ </span><span id="L-2"><a name="L-2"></a>http://developers.facebook.com/docs/reference/plugins/like/ </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>/*twitter*/ </span><span id="L-5"><a name="L-5"></a>http://twitter.com/about/resources/tweetbutton </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>/*google plus 1*/ </span><span id="L-8"><a name="L-8"></a>http://www.google.com/webmasters/+1/button/index.html </span></pre></div> </td></tr></table>
facebook, google+1, twitter