Ignoring ‘a’ when sorting posts

That’s because you are matching from the fourth character as it was supposed to be used only with “the ” (three characters onwards). Then the author of article added an “an ” which has a similar effect. I think he didn’t test for “a ” after all. Your code matches this: Horror of Party Beach … Read more

WordPress conflict with multiple load more posts functions on click

check your portfolio-scripts.js and blog-scripts.js both action contain same action. ‘action’: ‘load_more_posts’, So for your portfolio-scripts.js action Should be ‘action’: ‘loadmore_portfolio_posts’, instead of ‘action’: ‘load_more_posts’, You declare the function in portfolio-scripts.php but not call in the ajax. I guess change the action solve your problem.

What is the best way to reset a search on a meta_key / meta_value?

I wouldn’t push the meta query entries like that but build it more logical. So for example: $meta_query_args = array( ‘relation’ => ‘AND’ ); // assuming you want ‘AND’ search, you’re using both in your example if ( ! empty( $_POST[‘city’] ) && $_POST[‘city’] != ‘0’ ) { $meta_value_ville = $_POST[‘city’]; $meta_query_args[‘city_clause’] = array( ‘key’ … Read more

WP_Query extended with AJAX

this is my geo_query extension of wp_query: add_filter( ‘posts_fields’, ‘willy_geo_fields’, 10, 2 ); function willy_geo_fields( $fields, $q ) { if ( isset( $q->query_vars[‘geo_query’][‘latfrom’], $q->query_vars[‘geo_query’][‘lngfrom’], $q->query_vars[‘geo_query’][‘latto’], $q->query_vars[‘geo_query’][‘lngto’], $q->query_vars[‘geo_query’][‘distancefrom’], $q->query_vars[‘geo_query’][‘distanceto’] ) ) { global $wpdb; $fields .= $wpdb->prepare(“, ( 6371 * acos( cos( radians( %f ) ) * cos( radians( metalatfrom.meta_value ) ) * cos( radians( metalngfrom.meta_value … Read more

List users by Year of Birth using a foreach loop to dynamically populate years and data

So, I solved this by doing a regular get_user() and putting it inside a for loop of years and ran the get_user on each year. $currentYear = date(‘Y’); $years = range($currentYear, 1900); foreach($years as $year){ $TotalArray = get_users(array(‘meta_key’ => ‘date_of_birth’, ‘meta_value’ => $year, ‘count_total’ => true, ‘meta_compare’ => ‘LIKE’, ‘role__in’ => ‘members’)); $thisYearsTotal = count($TotalArray); … Read more

Query custom meta value – post view and date meta

@Sadia Please, try this once:: $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => ‘3’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘post_view’,// say 200 ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DSC’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘post_view_last’,//2017-04-14 ‘value’ => date(‘Y-m-d’, strtotime(‘-7 days’)), //value of “order-date” custom field ‘compare’ => ‘>=’, //show post less than … Read more