Elementor custom query

This just requires adding additional parameters to the query->set() array… …it’s standard WP_Query() stuff. So you’d essentially be taking this line: $query->set( ‘post_type’, [ ‘libri’, ‘post’] ); …and expanding it to include a tax query… $tax_query = array( ‘relation’ => ‘OR’, //can also use ‘AND’ depends how you want it to work array( ‘taxonomy’ => … Read more

Undefined variable [closed]

As the error states, your $my variable is not defined. The reason behind it is that you only defines $my when $the_query->have_posts(). Adding $my = ‘No results found’; right after $the_query = new WP_Query( $args ); would solve your problem. $my would then be redefined if results are found.

Hook to get the query result after listing posts

Hook to get the query result after listing posts Use the loop_end hook – it passes the WP_Query by reference. add_action( ‘loop_end’, ‘wpse_263822_loop_end’, 10, 1 ); function wpse_263822_loop_end( $query ) { //* Make sure we’re in the loop if( ! in_the_loop() ) { return; } //* Do something useful with the WP_Query print_r( $query->posts ); … Read more

How to handle wp_query?

You’re not showing your entire code, so not all of these suggestions may be relevant: Use distinct, ideally descriptive, names for the variables that hold the different queries. Using the same variable, $my_query, can lead to unintended consequences. Be sure to close the first loop properly, with endwhile; endif;, before opening the second loop. Be … Read more

Display biography post for today’s birthday person

Well there is no Generic solution for your problem/query as WordPress is not Specifically made Biography directory. Solution will depend on the approach you have followed. Have you created Custom User Role and add biography user under that user role OR Have you created Custom Post Type for Biography and add posts under that ? … Read more