Skip to content

Instantly share code, notes, and snippets.

View Page-Carbajal's full-sized avatar

Page Carbajal Page-Carbajal

View GitHub Profile
@Page-Carbajal
Page-Carbajal / get-post-thumbnail.gist.class.php
Last active May 19, 2018 03:20
WordPress - Get Post Thumbnail URL
<?php
/**
* Return the Post Thumbnail URL if $post has thumbnail
* $post is a WordPress Post Object
* @param $post
* @return string
*/
private function getPostThumbnailURL( $post ){
if ( has_post_thumbnail( $post->ID ) ){
@Page-Carbajal
Page-Carbajal / Aggregate Posts by Day of the Year
Last active August 29, 2015 14:24
Query to Aggregate Published posts by Day
Select post_date, count(post_date) as post_count from wp_posts
where post_status = 'publish'
and ( post_date between '2015-05-01' And '2015-05-30' )
Group By DAYOFYEAR( post_date )
;
@Page-Carbajal
Page-Carbajal / Pre-Get-Posts-Filter.class.php
Last active August 29, 2015 14:21
WordPress pre_get_posts Filter
<?php
namespace WordPress\Filters;
class PreGetPosts{
public $filterPriority = 10;
public function __construct( $priority = 10 ){
//TODO: Set your custom properties if needed
$this->filterPriority;