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
Insert them terms first using wp_insert_term, then associate them to the post.
Yes, this is achievable with the action ‘template_redirect’ I’ve left to write code to find sub-category for yourself! function my_subcat_template() { if ( <is sub category>) { include (TEMPLATEPATH . ‘/category-fun.php’); exit; } } add_action(‘template_redirect’, ‘my_subcat_template’); Update This is a better answer for your problem Put this is functions.php What it does is, it redefines … Read more
This might help you to find your solution. print the result of get_terms without arguments $chaptertitles=get_terms( ‘chapters’); print_r($chaptertitles); Check in above result can you get the item id 74 & 76. I think you might not get the the item id 74 & 76 that’s why you get the zero for $count1. Include the item … Read more
first get tag slug from your saved meta key my-tag-slug in a variable $tag_slug = (isset(get_post_meta(get_the_ID(), ‘my-tag-slug’, true))) ? get_post_meta(get_the_ID(), ‘my-tag-slug’, true) : null; now query posts by $tag_slug replace showposts with posts_per_page $args = array( ‘tag’ => $tag_slug, ‘posts_per_page’ => 5, ‘caller_get_posts’ => 1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { echo … Read more
Your logic looks to me like it boils down to “if union is selected, then echo a link to union, else do nothing.” I think your description is much too complicated. It looks like you can effectively ignore paid completely. function wpv_check_for_union_func($attr,$content=””) { global $post; $taxonomy = ‘yourtaxslug’; $union = has_term(‘union’, $taxonomy, $post); if ($union) … Read more
Update fields with post object and custom tax with wp_insert_post
terms parameter of tax query is required. Just pass to it all the terms for taxonomy $args = array( ‘post_type’ => ‘cars’, ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘brand’, ‘field’ => ‘slug’, ‘terms’ => ‘bmw’ ), array( ‘taxonomy’ => ‘color’, ‘field’ => ‘id’, ‘terms’ => get_terms(‘color’, array(‘fields’=>’ids’) ) ) ) ); Note … Read more
I was able to achieve this by, funnily enough, using with get_pages() and WP_Query(). I wanted a reusable function that would return a WP_Query array that I could loop through, so I came up with this: function returnChildGeographies($geoID, $geoType, $grandChildren = false) { $args = array( ‘post_type’ => ‘geographies’, ‘posts_per_page’ => -1, ‘orderby’ => ‘post_title’, … Read more
If you really need to sort by taxonomy term, I think you have a bad design of the data structure in your application. Think about it. A taxonomy is a way to group things, lets say posts. A taxonomy is a group of “terms” and the posts are grouped by the shared “terms” between them. … Read more