This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _dbdb_wp_count_posts( $counts, $type, $perm ) { | |
global $pagenow; | |
if( 'edit.php' !== $pagenow ){ | |
return $counts; | |
} | |
if( current_user_can( 'manage_options' ) ){ | |
return $counts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bootstrap_link_pages( $args = '' ) { | |
$defaults = array( | |
'before' => '<p>' . __( 'Pages:' ), | |
'after' => '</p>', | |
'link_before' => '', | |
'link_after' => '', | |
'next_or_number' => 'number', | |
'nextpagelink' => __( 'Next page' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
'use strict'; | |
function change_avatar_div( e ){ | |
var field = $(e.currentTarget); | |
var acw_avatar_div = field.closest('.acw-thumb-size-wrap').find('.acw-avatar'); | |
if( acw_avatar_div.length ) { | |
var icon = $( '.acw-icon', acw_avatar_div); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT c.* | |
FROM `dbdb`.`wp_comments` c | |
LEFT JOIN `dbdb`.`wp_comments` c2 ON c.comment_post_ID = c2.comment_post_ID AND c.comment_date_gmt < c2.comment_date_gmt | |
JOIN `dbdb`.`wp_posts` ON `dbdb`.`wp_posts`.ID = c.comment_post_ID | |
WHERE c2.comment_date_gmt is NULL | |
AND ( c.comment_approved = '1' ) | |
AND c.comment_type NOT IN ('pingback', 'trackback') | |
AND `dbdb`.`wp_posts`.post_status IN ('publish') | |
AND `dbdb`.`wp_posts`.post_type IN ('post') | |
ORDER BY c.comment_date_gmt DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT c.comment_ID | |
FROM wp_comments c | |
JOIN | |
( SELECT wp_comments.comment_post_ID, max(wp_comments.comment_date_gmt) maxDate | |
FROM wp_comments | |
GROUP BY wp_comments.comment_post_ID | |
) c2 | |
ON c.comment_date_gmt = c2.maxDate AND c.comment_post_ID = c2.comment_post_ID | |
JOIN wp_posts | |
ON wp_posts.ID = c.comment_post_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_feed_filter($query) { | |
if ( $query->is_feed && 'cpt_shop' === $query->get('post_type') ) { | |
$query->set('order', 'asc'); | |
$query->set('meta_key', '_alt_title'); | |
$query->set('orderby', 'meta_value'); | |
}; | |
return $query; | |
}; | |
add_filter('pre_get_posts','my_feed_filter'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter the terms query SQL clauses. | |
* | |
* @see 'terms_clauses' filter in get_terms() wp-includes/taxonomy.php | |
* | |
* @since 0.1.0 | |
* | |
* @todo add filter for $allowed_orderby_keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function post_type_category_fix($request) { | |
if ( isset($request['category_name']) && !isset($request['post_type']) ) | |
$request['post_type'] = 'any'; | |
return $request; | |
}; | |
add_filter('request', 'post_type_category_fix'); |