Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tennis club theme fix, add the code starting on line 4 to a child theme's functions.php file, or into a site functions plugin.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
if ( !function_exists( 'tennisclub_query_posts_where' ) ) {
function tennisclub_query_posts_where($where, $query) {
global $wpdb;
if (is_admin() || $query->is_attachment) return $where;
if (tennisclub_strpos($where, 'post_status')===false && (!isset($_REQUEST['preview']) || $_REQUEST['preview']!='true') && (!isset($_REQUEST['vc_editable']) || $_REQUEST['vc_editable']!='true')) {
if (current_user_can('read_private_pages') && current_user_can('read_private_posts'))
$where .= " AND ({$wpdb->posts}.post_status='publish' OR {$wpdb->posts}.post_status='private' OR {$wpdb->posts}.post_status='sold_out')";
else
$where .= " AND ({$wpdb->posts}.post_status='publish' OR {$wpdb->posts}.post_status='sold_out')";
}
return $where;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.