Breaking Bootstrap Grid at Post Count with Tax Terms

I’m not exactly sure where you want your clearfix to come in, but you should be able to do something like this: <div class=”row”> <?php $libargs=array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 0, ‘exclude’ => array(16, 20, 22,25, 27, 28, 30, 4), //* Enter ID’s of parent categories to exclude from list ‘taxonomy’ … Read more

How can I add a custom permalink to a term?

I’ve done something similar to what you are after here, but I was simply filtering by a meta key. add_action(‘init’, ‘add_custom_meta_url’); function add_custom_meta_url() { global $wp,$wp_rewrite; $wp->add_query_var(‘food’); $wp_rewrite->add_rule(‘food/([^/]+)’,’index.php?food=$matches[1]’,’top’); $wp_rewrite->flush_rules(false); // This should really be done in a plugin activation } And then apply this to the index query through query vars (you’d have to target … Read more

Geographic search with taxonomy structure [duplicate]

Enter your form where ever you plan to display it /**** The Form ****/ <form name=”searchcars” method=”get” action=”http://yourdomain.com/your-page-template-slug”> <label>Search</label> <input type=”text” name=”searchfor”> <label>Location</label> <Select name=”location”> <?php $locations = get_terms(‘locations’); foreach($locations as $location) { ?> <option value=”<?php echo $location->slug; ?>”><?php echo $location->name; ?></option> <?php } ?> </select> <button type=”select” name=”search”>Search</button> </form> Create a new file template, … Read more

pre_get_posts post_meta event

If you have store date different then timestamp it will be VERY hard to do this. To get this if is timestamp stored, you need add “meta_query” like this: add_action(‘pre_get_posts’, ‘my_pre_get_posts’); function my_pre_get_posts($query) { $offest = 0;// you must count this to avoid today and tomorrow $query->set( ‘meta_query’, array( ‘relation’ => ‘AND’, array( ‘key’ => … Read more

Several taxonomy query (like filter)

You would have to add the tax_query parameters depending on if the value is there in the GET parameters. So it would be something like this, $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, ) ); $car = $_GET[“car”]; if(!empty($car)){ array_push( $args[‘tax_query’], array( ‘taxonomy’ => ‘pa_my_taxonomy’, ‘field’ => ‘name’, ‘terms’ => … Read more

Get custom taxonomy name (not the term) in custom post

I have found an hopefully elegant solution $taxonomy_names = get_object_taxonomies( $post, ‘objects’ ); foreach ($taxonomy_names as $tax) { if ($tax->query_var != ‘tag’) { // needed because $taxonomy names containes more than one query_var $current_tax_name_slug = $tax->query_var; } } This one works for me