Regarding a custom loop and output HTML tags

It seems you are confusing actions and filters here. You are using an action. That means if you want to output some html you have to that inside the function. Now your are returning the value, but nothing is done with it. So in the last line of your function you should have echo $title_yama … Read more

How to query users by post count no less than 10

I can see in your code you did mistakes with meta key arguments. You must use underscore instead of hyphen sign. Here is corrected code: $args = array( ‘number’ => 5 , ‘meta_key’ => ‘post_count’, ‘meta_value’ => 10, ‘meta_compare’ => ‘>’, ‘orderby’ => ‘rand’ ); $user_query = new WP_User_Query( $args ); if ( ! empty( … Read more

How to query 5 users in random who have published more than 10 posts

I tried this code and it should work for you In your function.php to make random order available in WP_User_Query function my_random_user_query( $class ) { if( ‘rand’ == $class->query_vars[‘orderby’] ) $class->query_orderby = str_replace( ‘user_login’, ‘RAND()’, $class->query_orderby ); return $class; } add_action( ‘pre_user_query’, ‘my_random_user_query’ ); Source And a query like this // Get all users id … Read more

Get last child of given page by ID

WP_Query defaults to getting posts, not pages. From the above reference page: Display content based on post and page parameters. Remember that default post_type is only set to display posts but not pages. This code: // WP_Query arguments $args = array( ‘post_parent’ => ‘4117’, ‘post_type’ => ‘page’, ‘posts_per_page’ => ‘1’, ‘order’ => ‘DESC’, ‘orderby’ => … Read more

Filtering WP_Query based on wp_postmeta keys values

This is the answer to my question: $args = array( ‘post_type’ => ‘myType’, ‘post_per_page’ => $number, ‘showposts’ => $number, ‘meta_query’ => array( array( ‘key’ => ‘month’, ‘value’ => array(date(“F”),date(“F”, strtotime(‘+1 month’))), ‘compare’ => ‘IN’ ), array( ‘key’ => ‘day’, ‘value’ => date(“j”), ‘compare’ => ‘>=’ ), array( ‘key’ => ‘year’, ‘value’ => date(“Y”), ‘compare’ => … Read more