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

Show post like this image in my newssite [closed]

I’m not sure what you’re asking for. If you need a simple query for a category. try generatewp.com for the fastest solution. Here’s how to code it yourself. https://codex.wordpress.org/Class_Reference/WP_Query you’ll want to use the Category_Parameters

Can’t get LIKE to work with wp_query [closed]

When you set up the meta_query value like: ‘value’ => “‘” . $city . “‘”, it gets translated to LIKE ‘%\’ondon\’%’ in the final SQL query, which matches things like L’ondon’ or L’ondon’er but not London. But you actually want it to be like: LIKE ‘%ondon%’ – so you should do: ‘value’ => $city, EDIT … Read more

How can I echo out the user id in user meta?

If you want to display the info on the current user logged in you can use get_currentuserinfo. [Codex] Example from Codex <?php global $current_user; get_currentuserinfo(); echo ‘Username: ‘ . $current_user->user_login . “\n”; echo ‘User email: ‘ . $current_user->user_email . “\n”; echo ‘User first name: ‘ . $current_user->user_firstname . “\n”; echo ‘User last name: ‘ . … Read more

Query page: preserve page formating

You’re comparing apples to oranges here. Both queries do the exact same thing, but are presented through different code. Your query: <?php $my_postid = 663;//This is page id or post id $content_post = get_post($my_postid); $content = $content_post->post_content; $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); echo $content; ?> Merely pulls some content out of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)