How to create filterable portfolio in WordPress?

You’re setting $terms_portfolio too early. You’re using get_the_terms( get_the_ID(), ‘portfolio_categories’), but get_the_ID() won’t be the current portfolio in the loop because $portfolio_query->the_post() hasn’t run yet. Change this bit: <?php $portfolio_query = new WP_Query(array( ‘post_type’ => ‘portfolios’, ‘order’ => ‘DESC’, )); $terms_portfolio = get_the_terms( get_the_ID(), ‘portfolio_categories’); ?> <?php if($portfolio_query->have_posts()) : while($portfolio_query->have_posts()) : $portfolio_query->the_post(); ?> <div class=”col-md-4″ … Read more

How to get only one category of custom post type?

Never use query_posts! Use get_posts() or new WP_Query() instead. I think this will work however: $today = date(“Y/m/j”); $args = (array( ‘post_type’ => ‘event’, ‘posts_per_page’ => 10, ‘orderby’ => array( ‘wpse_meta_query_name’ => ‘ASC’, ‘post_title’ => ‘DESC’ // optional second orderby paramater ), ‘meta_query’ => array( ‘wpse_meta_query_name’ => array( // give the meta query arguments a … Read more

Multiple Archive Pages for Custom Post Types AND Taxonomies

You can create the taxonomy-{$custom_taxonomy}.php that will handle all request for you custom taxonomy, and rely on query string to show events based on month. The url can change based on your setting, but should be something like this: http://yourdomain.com/custom-taxonomy/term-a/?month=2013-07 Hooking into pre_get_posts action (search codex) you can modify the query for that taxonomy and … Read more

Taxonomy based permalinks

Try something like this: function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘(.+)/blog/(.+)’ => ‘index.php?custom_tax=’.$wp_rewrite->preg_index(1).’&post_name=” . $wp_rewrite->preg_index(2) ); // ( array merge must be done this way, to ensure new rule comes first ) $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if this is changed in any way add_filter( “generate_rewrite_rules’, … Read more

Limit taxonomy results to a single cpt

Before the loop in your taxonomy-locations.php file, global $wp_query; $args = array_merge( $wp_query->query, array( ‘post_type’ => ‘report’ ) ); query_posts( $args ); You could, alternatively, modify the query using an appropriate hook (this would be the most effecient method) – but since it is run for most queries, you would need to check it’s actually … Read more

Custom post type permalinks giving 404s

My plugin Custom Post Permalinks does this sort of thing for you: http://wordpress.org/extend/plugins/custom-post-permalinks If you’d rather use your own solution, I’ll need a bit more information, such as the registration code for the forums taxonomy. Just guessing, I’m thinking the regex for a forum looks identical to the regex for a topic to the rewrite … Read more