WP Meta Query at depth 2
WP Meta Query at depth 2
WP Meta Query at depth 2
This is possible using a third party plugin. Most SEO Plugins let you manually set the Title and Description of the page independent from the Title and Slug of the post. The Slug itself is unique over the place to avoid duplication. One Plugin I know which is doing this good and works well in … Read more
Okay, so long story short… there’s no built-in wordpress way to Query the meta-data directly, but in the interests of helping others, essentially you need to do it the old-fashioned way… using SQL: I’m going to do up a post which I’ll link to… but essentially it involves straight SQL and $wpdb->get_results and some PHP … Read more
This seems a little inconvenient since there are two hops from posts to terms to term meta. WP_Query cannot operate with term meta since it doesn’t directly apply to posts. Without knowing more context of your situation and term counts involved I would guess: Pre-calculate and cache the list of valid terms (those that fall … Read more
you can use ajax url creating methode of wordpress. add_action(“wp_ajax_clientLogoPopup”, “clientLogoPopup”); add_action(“wp_ajax_nopriv_clientLogoPopup”, “clientLogoPopup”); function clientLogoPopup() { $clientID = intval($_REQUEST[‘client_id’]); if($clientID > 0){ echo get_post_meta($clientID , ‘client_logo’, true); // or you can also show other meta fields here. } die(); } write above script in functions.php of your theme now call the url as per your … Read more
Find The problem 😉 The answer is $hot_args = array( ‘post_type’ => ‘video’, ‘posts_per_page’ => ‘6’, “order” => “DESC”, ‘meta_key’ => ‘post_views_count’, ‘orderby’ => ‘meta_value_num’, ‘date_query’ => array( array( ‘after’ => ‘1 week ago’ ) ), “post__not_in” => $posts__not_in, ); $hot_query = new WP_Query( $hot_args ); There was not video as my custom post type … Read more
First: don’t use query_posts. It will confuse the main WordPress loop. You will need two queries. First use the query you have already constructed to get the priority posts: $query1 = new WP_Query( $args ); // here use the $args you already have Now count how many posts are returned to set the maximum return … Read more
Use below code to get attached image title and alt. //Get attachment title & alt… $attachment_title=””; $attachment_alt=””; $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => 1, ‘post_status’ => null, ‘post_parent’ => $post->ID, ‘post_mime_type’ => ‘image’); $attachments = get_posts($args); //If attachments exist… if($attachments) { //Loop until attachments… foreach( $attachments as $attachment ) { $attachment_title = $attachment->post_title; … Read more
I figured it out. Somehow in the import process a trailing space was added to the meta_key (making it “_thumbnail_id “). Mysql apparently matches on a trailing space which is why it wasn’t apparent, but once I removed the space all featured images started showing again.
How to get Current week and current date record wp query