Custom menu breaks down

Custom nav menus are also a query, which you end up altering with that code. Your best bet is to check to make sure it’s the main query, e.g. by globaling $wp_the_query and doing a strict comparison with $query or doing $query->is_category() instead (I believe that works – somebody will smack me down if it … Read more

Show 10 newest post for each value of a custom taxonomy

This code runs a foreach loop through each value associated with the language taxonomy then runs a query on that value to get the posts associated with it. $taxonomies = get_categories( array( ‘taxonomy’ => ‘language’ ) ); foreach ( $taxonomies as $tax ) { global $post; $args = array( ‘language’ => $tax->category_nicename, ‘posts_per_page’ => 10 … Read more

Custom Post Type Query W/Category Dropdown

You seem to be using 2 separate queries there, the first (query_posts) won’t do anything, and the second is the query that will be used. Have you tried: $args=array( ‘category__in’ => $cats, ‘post_type’ => ‘profiles’, ‘posts_per_page’ => 10, ‘order’=> ‘ASC’, ‘orderby’ => ‘title’ ); $loop= null; $loop = new WP_Query($args); Try that instead of: query_posts(array( … Read more

Select Venue from dropdown list and reuse stored address information in meta_box

You’re already storing the venue, so you should be able to simply extract from an array front-side based on what a get_post_meta call returns. If i’m following you correctly still at this point, something along these lines should do the trick. function get_related_event_data( $venue, $field = ‘all’ ) { $event_data = array( ‘Spruce Gallery’ => … Read more

One Custom Post Type two different Templates

Yes it is possible. You’ll have to write a custom rewrite rule for making the domain.com/cpt/metaboxes url to be accessible. Lets say your cpt is ‘movie’, its single will be accessible as domain.com/movie/slug. Create a new page named ‘Metaboxes’ (slug should be ‘metaboxes’). Add the following code to functions.php. <?php add_action(‘init’, ‘add_my_rule’); function add_my_rule() { … Read more

Shortcode in pages or tempate files for custom post type

Lucas Wynne linked some good plugins for such functionalities (I have used Addthis multiple times), however if you’re looking for a plugin-free solution, i’d more likely filter the content in my functions.php file instead of using a shortcode : some pseudo-code function add_content( $content ){ $content .= “<a href=\”facebook\”>FACEBOOK</a>”; return $content; } For more info … Read more

List of all posts in one custom post type in the edit screen of another

if you are trying to make ralationship links between post types, the easiest way is to use the great “posts 2 posts” plugin by Scribu : http://wordpress.org/extend/plugins/posts-to-posts/ here is the documentation : https://github.com/scribu/wp-posts-to-posts/wiki hope that could help. seb. EDIT : Is there a way to list all the posts created under one custom post type … Read more