How to hook custom taxonomies to custom post types and make the permalinks work?

Two things – I think the category URL would be: yourdomain.com/news_category/NEWS-CATEGORY-SLUG-HERE So for example if you created a category “top headlines” in your “news_category” taxonomy… it would look like this (assuming the slug for “top headlines” is “top-headlines”): /news_category/top-headlines/ The second thing… I think your template name should be “taxonomy-news_category.php” (edited to add – I … Read more

How can I set taxonomy programmatically

You should hook your actions to the save_post hook. It fires right after the post is created and the $post_id and other $post data variables are already available. Something like this should do the trick: add_action( ‘save_post’, ‘jason_code_save_post’, 10, 2 ); function jason_code_save_post( $post_ID, $post ) { if ( ‘code’ != $post->post_type || wp_is_post_revision( $post_ID … Read more

How do I list the pages of a custom taxonomy?

To answer my question: You can use the loop to query only posts based on a taxonomy & terms : query_posts(‘taxonomy’=’term’); & then run the loop: if ( have_posts() ) : while ( have_posts() ) : the_post(); echo ‘<h6>’; ?> <a href=”https://wordpress.stackexchange.com/questions/36592/<?php the_permalink(); ?>”><?php the_title(); ?></a> <?php echo ‘</h6>’; the_date(); the_excerpt();

Taxonomy template shows only 10 posts

Sorry – this is probably an obvious answer but without seeing your query_posts query it’s hard to say if you’ve tried this or not. As you’re altering the main query on the page query_posts should be the right tool for the job. Something like the following query should work: <?php query_posts( ‘posts_per_page=100’ ); ?> <?php … Read more

How can I populate a select element with terms from a custom taxonomy and filter post results?

Are you familiar with jQuery? You’ll want to post the term to a admin-ajax, and use the response to populate the second select. Here is the codex documentation: http://codex.wordpress.org/AJAX_in_Plugins A loose example for your situation: $first_term = $(‘#states’); $name = $first_term.children(‘option:selected’).text(); var data = { action: ‘tag_slug’, slug: $slug }; var ajaxurl=”wp-admin/admin-ajax.php”; $.post(ajaxurl, data, function(response) … Read more

Which post does a taxonomy term belongs to?

You could do it using the term_link filter. Something roughly as follows: function my_term_link($termlink, $term, $taxonomy) { global $post; if ($taxonomy == ‘my-custom-taxonomy’) { return get_permalink( $post->ID ) . ‘#’ . $term->term_id; } } while ( $programtype->have_posts() ) : $programtype->the_post(); $terms = get_the_terms( $post->ID, ‘my-custom-taxonomy’ ); add_filter(‘term_link’, ‘my_term_link’, 10, 3); foreach ($terms as $term) { … Read more