Archive for custom taxonomy lists all posts instead of current taxonomy

You have a syntax error in your query. According to the documentation for WP_Query, tax_query is an array of arrays of parameters, which is to say that it should probably look like this: ‘tax_query’ => array( array( ‘taxonomy’ => ‘semester’, ‘field’ => ‘slug’, ‘terms’ => $getterm, ‘include_children’ => true, ‘operator’ => ‘IN’ ), ),

Custom Post Type / Two level deep taxonomy (cat. and subcat.) uri problem (error 404)

After many headaches, I’ve spent days and hours finding a solution. I’ve find a solution for two problems commented above. I hope it helps to someone: PROBLEM 1: I realized that when I changed Permalink to Plain (wordpress admin > settings > permalink > Plain) and when I click in Breadcrumb link “iluminacion interior” it … Read more

Retrieve value of a category’s custom field

http://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/ prety much covers what you’re after I believe. So in your example while ( $projects->have_posts() ) { $projects->the_post(); $category_classes = array(); $categories = get_the_terms( get_the_ID(), ‘project_category’ ); if ( $categories ) { foreach ( $categories as $category ) { $categories_included[] = $category->term_id; $color = get_field(‘color’, ‘project_category_’.$category->term_id); } } You can also pass a term … Read more

Custom post type unintentionally called in every page

Custom post-type and taxonomy definitions are not saved to the database, and so registering them only makes WordPress “aware” of their existence for that page request. As custom post-type/taxonomy registration does not require database interaction, the performance impact is negligible. I’ve never actually seen any applications that selectively register CPTs/taxonomies (though I’m sure they’re out … Read more

Troubles with saving metabox

There are different ways of saving the metaboxes. for e.g. you can create 2 files 1) test-spec.php 2) test-meta.php In test-spec.php file <?php //DEFINE VARIABLE TO STORE THE METABOX $content_test_meta = new WPAlchemy_MetaBox(array ( ‘id’ => ‘_content_test_meta’, //UNIQUE ID FOR THIS META BOX ‘types’ => array(‘post’), //LIMIT TO ONLY SHOW ON Default POST TYPE ‘template’ … Read more

How to customize a permalink (URL) structure?

The GUID field is not a URL and should never be used for that purpose. It’s a unique identifier that happens to look like a URL, but it should never be trusted as such. WordPress has a number of functions for retreiving attachment URLs and files: get_children get_attached_media the_attachment_link get_attachment_link wp_get_attachment_link wp_get_attachment_image wp_get_attachment_image_src wp_get_attachment_url wp_get_attachment_thumb_file … Read more