Show Post Count of a Category
Show Post Count of a Category
Show Post Count of a Category
How to search by a post and a category name on wordpress at the same time?
Actually, I don’t think you need that mt1.post_id IS NOT NULL DESC sorting, hence you also do not need to use the posts_orderby hook. You can just use the orderby parameter in WP_Query like so: Also note that, in the first meta query clause named/keyed start_date_value, you should set the type arg to DATE (like … Read more
Without spending too long thinking about this one I would imagine you could do it with one query. $store_array = array(); while (have_posts()) : the_post(); $store_type = // get term id, slug, name from store type taxonomy $store_floor = // get term id, slug, name from floor taxonomy $store_array[$store_type][$store_floor] = $post->ID; endwhile; // run a … Read more
Managed to figure it out by adapting that code from the link i posted: function atom_search_where($where){ global $wpdb; if($_SESSION[‘js’] != ”) $where .= “OR (t.name LIKE ‘%”.trim($_SESSION[‘js’]).”%’ AND {$wpdb- >posts}.post_status=”publish”)”; $where .= “OR ($wpdb->postmeta.meta_key = ‘_job_ref’ AND $wpdb->postmeta.meta_value=””.$_SESSION[“js’].”‘)”; return $where; } function atom_search_join($join){ global $wpdb; if($_SESSION[‘js’] != ”) $join .= “LEFT JOIN {$wpdb->term_relationships} tr ON … Read more
Just figured it out. The post type had a custom taxonomy so had to replace category_name with slides_categories
Two problems i see: change aside to post-format-aside and since you are using foreach loop change new WP_Query( $singargs ); to get_posts( $singargs ); so your code sould look like this: <?php $singargs = array( ‘numberposts’ => 1, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array ( … Read more
Yes, AJAX is the way to go. Basically, you can write your own callback function for WP’s ajax hook in your theme’s functions.php file. And then your function can return data in any format you choose. I generally return JSON. I’ll walk you through setting it up. First, since it doesn’t appear that your visitors … Read more
Haven’t tested this, but here you go, lemmie know how it works. You’ll needa do your own pagination links, but that should be pretty straightforward //pagination $offset=”0″; $no_of_posts = the_posts_per_page( false ); //Number of posts to display on each page if (preg_match( ‘/page/’, $_SERVER[‘REQUEST_URI’] ) ) { $uri = explode( “https://wordpress.stackexchange.com/”, $_SERVER[‘REQUEST_URI’] ); foreach ( … Read more
I would write a converter and separate all of these data once. There is just no way to build a really fast query against serialized data.