Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type

The code you need will vary slightly depending on whether the Conference field is storing a text string (like “Big Ten”) vs. the ID of the Conference post. I’ll include both: Text String Example // place this code inside the loop of your single-team template $conference_name = get_post_meta( get_the_id(), ‘conference’, true ); $conference = get_page_by_title( … Read more

List child categories from parent category on custom taxonomy page

Two things! 1) Don’t use query_posts()! Instead, for situations like this, use the pre_get_posts action to modify the query. 2) I don’t think you actually want to be using a loop here at all (so neither query_posts() nor pre_get_posts or even WP_Query). Rather, I think you’re looking for wp_list_categories. In your template, you’d probably do … Read more

Custom Post Type View Button in Admin Gives 400 Error

I found a solution here: Custom post types, taxonomies, and permalinks TheDeadMedic’s solution worked like a charm. function filter_post_type_link($link, $post) { if ($post->post_type != ‘project’) return $link; if ($cats = get_the_terms($post->ID, ‘project_categories’)) $link = str_replace(‘%project_categories%’, array_pop($cats)->slug, $link); return $link; } add_filter(‘post_type_link’, ‘filter_post_type_link’, 10, 2); This checks to see what Project Categories are associated with the … 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

Creating a Category Taxonomy

I would really suggest using one custom post type and one custom taxonomy with terms under the custom taxonomy which is assigned to a show. This structure will function exactly like normal posts with normal categories, the only difference is that it will be outside the scope of default blogging as custom post types are … 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