Show custom content when loop or wp query reaches specific time?
Show custom content when loop or wp query reaches specific time?
Show custom content when loop or wp query reaches specific time?
Get authors list and sort them by recent posts
You’re referencing the global $wp_query object in your function which you’ve reset using wp_reset_query(). You can resolve the pagination by passing your custom $loop WP_Query object to the function. I also changed wp_reset_query to wp_reset_postdata Also you’re making the call to your pagination function in the while loop instead of after it. Your function should … Read more
// Get the category ID from url $catsearched = $_GET[‘product_cat’]; //printf($catsearched); $earth_radius = 6371; // Get products of category with in range distance $querystrShop = $wpdb->prepare(” SELECT productid AS post_id,(%d * ACOS(COS(RADIANS(%s)) * COS(RADIANS(phiz_geo_location.latitude)) * COS(RADIANS(phiz_geo_location.longitude) – RADIANS(%s)) + SIN(RADIANS(%s)) * SIN(RADIANS(phiz_geo_location.latitude)))) AS distance, phiz_postmeta.meta_value FROM phiz_geo_location JOIN phiz_term_relationships ON phiz_geo_location.productid = phiz_term_relationships.object_id LEFT JOIN … Read more
Where is the coding error for the unexpected ‘}’ in this if / else choice of loops?
Show a message if there are no active posts in category
New template file does not load category-specific post
Use the save_post hook to check if a post that is being saved is a portfolio page and reset the transient. add_action( ‘save_post’, ‘reset_portfolio_transient’, 10,3 ); function reset_portfolio_transient( $post_id, $post, $update ) { // Only set for portfolio post_type if ( ‘portfolio’ !== get_post_type($post) ) { return; } // delete old tranisent delete_transient( ‘randomizeProfiles’ ); … Read more
Update: The User has clarified the request in the comment to my answer, so i add some info above my original answer. The original answer is still valid 😉 To use external data for your “main” query, you can use the pre_get_posts hook. Use it like this: add_action(‘pre_get_posts’,’get_radius_instructors_for_my_posts’); function get_radius_instructors_for_my_posts($query){ if($query->is_main_query() && !is_admin()){ if($query->is_search()){ //use … Read more
the_permalink() echoes the output, and so does the_title() by default. So you should use get_permalink() and get_the_title(): $html .= ‘<h3><a href=”‘ . get_permalink() . ‘”>’ . get_the_title() . ‘</a></h3>’; Or use the_title() with the third parameter set to false to return and not echo the output: $html .= ‘<h3><a href=”‘ . get_permalink() . ‘”>’ . … Read more