snipt

Ctrl+h for KB shortcuts

HTML+PHP

Share on Twitter

<a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" title="Click to send this page to Twitter!" target="_blank">Share on Twitter</a>
https://snipt.net/embed/d626d765e4f2199d2a3db8ec46fbad48/
/raw/d626d765e4f2199d2a3db8ec46fbad48/
d626d765e4f2199d2a3db8ec46fbad48
html+php
HTML+PHP
2
2019-06-23T01:12:04
True
False
False
/api/public/snipt/1941/
share-on-twitter-1
<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://twitter.com/home?status=Currently reading </span><span class="cp">&lt;?php</span> <span class="nx">the_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;Click to send this page to Twitter!&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 Twitter<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
social, twitter, wordpress

PHP

wordpress > get custom field

<?php $value = get_post_meta($post->ID, "customfieldname", true); ?>
https://snipt.net/embed/71c063049557f7567f7e92ddd975a80b/
/raw/71c063049557f7567f7e92ddd975a80b/
71c063049557f7567f7e92ddd975a80b
php
PHP
1
2019-06-04T22:32:35
True
False
False
/api/public/snipt/1657/
get-custom-field
<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="cp">&lt;?php</span> <span class="nv">$value</span> <span class="o">=</span> <span class="nx">get_post_meta</span><span class="p">(</span><span class="nv">$post</span><span class="o">-&gt;</span><span class="na">ID</span><span class="p">,</span> <span class="s2">&quot;customfieldname&quot;</span><span class="p">,</span> <span class="k">true</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
php, wordpress

SQL

clear wordpress revisions

DELETE FROM wp_posts WHERE post_type = "revision";  
https://snipt.net/embed/821429bafc8fafad21ecdb5682234478/
/raw/821429bafc8fafad21ecdb5682234478/
821429bafc8fafad21ecdb5682234478
sql
SQL
1
2019-06-24T07:22:54
True
False
False
/api/public/snipt/847/
clear-wordpress-revisions
<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="k">DELETE</span> <span class="k">FROM</span> <span class="n">wp_posts</span> <span class="k">WHERE</span> <span class="n">post_type</span> <span class="o">=</span> <span class="ss">&quot;revision&quot;</span><span class="p">;</span> </span></pre></div> </td></tr></table>
mysql, wordpress

Bash

upgrade wordpress

svn sw http://svn.automattic.com/wordpress/tags/3.8.1 .
https://snipt.net/embed/24a58163b95102f4efd1ca8501b22329/
/raw/24a58163b95102f4efd1ca8501b22329/
24a58163b95102f4efd1ca8501b22329
bash
Bash
1
2019-06-11T22:46:22
True
False
False
/api/public/snipt/836/
upgrade-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>svn sw http://svn.automattic.com/wordpress/tags/3.8.1 . </span></pre></div> </td></tr></table>
server, svn, wordpress