Skip to content

Instantly share code, notes, and snippets.

View web-hat's full-sized avatar

WebHat web-hat

View GitHub Profile
@web-hat
web-hat / whpp_track_post_views.php
Last active September 3, 2018 20:32
Display Popular Posts by Views in WordPress without a Plugin
<?php
function whpp_track_post_views($post_id) {
if (!is_single())
return;
if (empty($post_id)) {
global $post;
$post_id = $post->ID;
}
whpp_set_post_views($post_id);
@web-hat
web-hat / register_post_type.php
Created March 22, 2017 18:01
Add ‘/blog/’ Prefix in Blog Posts
<?php
$labels = [
"name" => __('Services', 'text-domain'),
//...
//...
];
$args = [
"label" => __('Services', 'text-domain'),
"labels" => $labels,