Error with function in functions.php?

These two lines are wrong: add_action(‘wp_ajax_get_data’, mm_get_all_informations); add_action(‘wp_ajax_nopriv_get_data’, mm_get_all_informations); You need to quote the function name: add_action(‘wp_ajax_get_data’, ‘mm_get_all_informations’); add_action(‘wp_ajax_nopriv_get_data’, ‘mm_get_all_informations’); If you had debugging enabled, as you should when you are working, you would have spotted the problem immediately.

Filter post query to only show direct children of category

I assume that by “direct children of category” you mean “posts directly assigned to the category” and not “posts assigned to child categories of the category specified”. The answer is in the Codex: Display posts that have this category (not children of that category), using category id: $query = new WP_Query( ‘category__in=4’ ); http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters Second, … Read more

WP_query – Filter by tax_query and meta_query using multiple select

My initial code did not provide default WP_query argument parameters if either Select option was not set – the empty Parameter would filter everything out. To the best of my ability, I applied default parameter values from the initial Post and Terms queries and now the select filter is working. I would be pleased to … Read more

Easy way to write complex queries in wordpress

I wouldn’t say it’s “easy”, but any complex queries like the one you have that can’t be handled via the API, WP_Query, or its filters should use the wpdb class. global $wpdb; $rows = $wpdb->get_results( ” SELECT p1.meta_value as avg, p2.meta_value as total, p1.meta_value * p2.meta_value as product FROM $wpdb->postmeta as p1, $wpdb->postmeta as p2 … Read more

Pagination doesn’t function properly for archive of a custom post type set as the front page

Between my phone and work some errors creeped in, sorry about that. here is my revised answer. Hope this helps in solving your problem. PROBLEM 1 You should not name your template ‘archive-{$post_type}.php’ if it is a page template. This totally goes against the template hierarchy for pages, and that is why your static frontpage … Read more

Meta query for comparing two dates

EDIT start and end date is following the date format. But you are using NUMERIC type casting in meta query. You need to use DATE type like array( ‘key’ => ‘user_registered’, ‘value’ => $start_date, ‘compare’ => ‘>’, ‘type’ => ‘DATE’ ), array( ‘key’ => ‘user_registered’, ‘value’ => $end_date, ‘compare’ => ‘<=’, ‘type’ => ‘DATE’ ) … Read more