snipt

Ctrl+h for KB shortcuts

PHP

trackback_count()

1
2
3
4
5
6
function trackback_count() {
	global $wpdb;
	$post_id = get_the_ID();
	$post_ping_count = $wpdb->get_var("SELECT count(comment_id) FROM $wpdb->comments WHERE comment_type in ('pingback','trackback') and comment_approved = 1 and comment_post_id = $post_id");
	return $post_ping_count;
}
https://snipt.net/embed/6267e47f1767402c97f89e2124ceb087/
/raw/6267e47f1767402c97f89e2124ceb087/
6267e47f1767402c97f89e2124ceb087
php
PHP
6
2019-08-22T08:41:16
True
False
False
Oct 05, 2015 at 04:07 PM
/api/public/snipt/141511/
trackback_count
<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="x">function trackback_count() {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> global $wpdb;</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> $post_id = get_the_ID();</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> $post_ping_count = $wpdb-&gt;get_var(&quot;SELECT count(comment_id) FROM $wpdb-&gt;comments WHERE comment_type in (&#39;pingback&#39;,&#39;trackback&#39;) and comment_approved = 1 and comment_post_id = $post_id&quot;);</span> </span><span id="L-5"><a name="L-5"></a><span class="x"> return $post_ping_count;</span> </span><span id="L-6"><a name="L-6"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
php, wordpress

Text only

htaccess change all files from .html to .php

RewriteEngine on
RedirectMatch 301 (.*)\.html$ $1.php
https://snipt.net/embed/30c204ead09242223505f6b10e45ef4c/
/raw/30c204ead09242223505f6b10e45ef4c/
30c204ead09242223505f6b10e45ef4c
text
Text only
2
2019-08-22T09:58:36
True
False
False
/api/public/snipt/137717/
htaccess-change-all-files-from-html-to-php-848ce893
<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>RewriteEngine on </span><span id="L-2"><a name="L-2"></a>RedirectMatch 301 (.*)\.html$ $1.php </span></pre></div> </td></tr></table>
html, php, to