Query all posts under one taxonomy? Why is my code not working?
You haven’t specified the ‘field’ value e.g. ‘field’ => ‘slug’, http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
You haven’t specified the ‘field’ value e.g. ‘field’ => ‘slug’, http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
You can use wp_list_categories() which by default, generates nested unordered lists (ul) and just pass product-category as the taxonomy parameter for example: add_filter(‘wp_nav_menu_items’,’add_custom categories’, 10, 2); function add_custom categories($items, $args) { $items .= ‘<li>’ . wp_list_categories( array(‘echo’ => 0, ‘taxonomy’ => ‘product-category’, ‘title_li’ => ‘Product Categories’) ) . ‘</li>’; return $items; }
You shouldn’t have to create a separate template file for each taxonomy. You can use the wp_list_categories function to create a list in your sidebar, the Codex article has a code example, but something like this should work: <ul> <?php wp_list_categories(‘taxonomy=workcategories’); ?> </ul>
I’d use a bunch of widget areas to build up a home page like that. Register some extra sidebars (in this case they don’t actually have to be ‘sidebars’, they can be any size/shape) and then create a widget or widgets that can list posts from any category or list sticky posts etc… Registering Sidebars … Read more
You’re trying to build the permalinks yourself? That looks really tricky and fragile. Also, you’re getting a little confused trying to deal with the $loop WP_Query object. When you call $loop->the_post();, what you’re doing is populating the global variable $post with the next post in the $loop query object. So everywhere that you’re iterating over … Read more
You can either set the taxonomies parameter of register_post_type, which accepts an array of taxonomies, or set object type to your custom post type (or array of types) when you register your taxonomy, or you can use the register_taxonomy_for_object_type function.
Taxonomies are sort of overkill in this case. Taxonomies are not required to have an archive page (they can be used for internal things only). Your nav menus, for example, are terms in a taxonomy — just a way of grouping content that belongs together. What you’re talking about is a bit outside of that … Read more
Well, I should have used the tax_query parameter. Something like the following: $the_query = new WP_Query( array(‘post_type’=>’ad_listing’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘ad_cat’, ‘field’ => ‘slug’, ‘terms’ => ‘7star’ ) ) ) );
Hook into ‘pre_insert_term’, $term, $taxonomy and dump the global $blog_id; to see if you’re on the right place: function wpse_inspect_blog_id( $term, $taxonomy ) { global $blog_id; var_dump( $blog_id ); exit; } function wpse_hook_inspector_blog_id() { add_filter( ‘pre_insert_term’, ‘wpse_inspect_blog_id’ ); } add_action( ‘init’, ‘wpse_hook_inspector_blog_id’ );
You should move – if not hierarchical – to “post_tags”, or a custom non-hierarchical taxonomy. The rest is more a query Question: New template > Query taxonomy > Add specific tags to the query Assign template to page Add page to menu So if you link to london and want to display all doctors, including … Read more