Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
Filter CPT based on meta box value using Flexible Posts widget?
home_url() uses get_home_url() which in turn uses get_option( ‘home’ ) to retrieve the home url. The code in get_option() includes this: // If home is not set use siteurl. if ( ‘home’ == $option && ” == $value ) return get_option( ‘siteurl’ ); I didn’t unwind all the previous code in the function, but it … Read more
You should be able to do this with WP_Query‘s meta_query parameters: $type=”something”; $programme=”another”; $args = array( ‘meta_query’ => array( array( ‘key’ => ‘type’, ‘value’ => $type, ‘compare’ => ‘=’ ), array( ‘key’ => ‘programme’, ‘value’ => $programme, ‘compare’ => ‘LIKE’ ) ) ); $query = new WP_Query( $args );
query by meta value then date and not empty meta value
You’ve asked for an array and you are trying to use an object. $key = “sc_event_year”; $value = $today_year; global $wpdb; $results = $wpdb->get_results(“SELECT * FROM $wpdb->postmeta WHERE meta_key = ‘sc_event_year’ AND meta_value = $value”, ARRAY_A); foreach ($results as $result){ echo $post_id = $result[‘post_id’]; // <– here was the problem } Unless $value is a … Read more
Clarification of your question: You want to show Posts of a certain category named “ABC” AND also you want to filter the posts with the tag named “XYZ”. Answer: If this is the scenario, have you tried: WP_Query()? <?php // The Query $args = array(‘post_type’ => ‘post’, ‘category_name’ => ‘ABC’, ‘tag’ => ‘XYZ’, ‘meta_key’ => … Read more
You should probably add the filter, then use a new query, then remove the filter. function filter_where( $where ) { $where .= ” AND post_date >= ‘2012-03-01’ AND post_date <= ‘2014-03-01′”; return $where; } add_filter( ‘posts_where’, ‘filter_where’ ); $query = new WP_Query( array( ‘post_type’ => ‘shop_order’ ) ); while( $query->have_posts() ) : $query->the_post(); the_title(); the_content(); … Read more
It seems you have same images in both post.
If your question is: I want this query to limit it self to the first page in wich i have 10 post I think adding a ‘posts_per_page’ => 10 array parameter will do the thing for you: query_posts( array( ‘post_type’ => ‘listings’,’type’ => ‘featured’,’posts_per_page’ => 10 ) ); But above all, I’d like to recommend … Read more