Tag Info

New answers tagged

0

What are the terms and taxonomy in wordpress? From WordPress.org's Taxonomy Codex... In WordPress, a "taxonomy" is a grouping mechanism for some posts (or links or custom post types)... The names for the different groupings in a taxonomy are called terms. Using groupings of animals as an example, we might call one group "birds", and ...


1

Your problem is that your trying to access taxonomy data before it is registered. This doesn't work: add_action('init', 'json_handler'); function json_handler(){ $categories = get_terms( 'my_cat', 'orderby=count&hide_empty=0' ); if( ! is_wp_error( $categories ) ) { // encode the $categories array as json print_r( json_encode( ...


0

To get the portfolio category in the url you could possibly navigate to Settings > Permalinks and add a custom structure like so %category%/%postname% that will add the category before the postname.


1

Most likely the problem comes from: $terms = get_the_terms( $post->ID, $args['taxonomy'] ); i.e. you have to make sure it's not false or WP_Error object. You should also check the output of: var_dump( $args ); Try for example: if( ! is_array( $terms ) ) return $output; or if( ! $terms || is_wp_error( $terms ) ) return $output; ...


0

Use wp_dropdown_categories, set hierarchical to true and set desired taxonomy.


0

ACF needs the term slug as a second parameter to be passed in order to retrieve the value. It's explained in detailed here. http://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/ get_field('field_name', term_slug');


0

So this is what I needed: <?php $terms = get_the_terms( $post->ID , 'board' ); foreach ( $terms as $term ) { echo $term->name; } ?>


0

Posts and Categories are tied together. Your best bet is creating custom post type that supports only your taxonomy. This way, your posts (which are now under your custom post type) will not have any conflict with wordpress assigning default category. If you explain your scenario with more details, I will be in better position to help you.


1

Here's the code, rewriten from posts and categories to custom post types and taxonomy terms. Thanks to @PieterGoosen for providing the first version. http://pastebin.com/xKBepGQz <?php $args = array( 'post_type' => 'produkty', // your CTP name 'meta_key' => 'produkt_nowosc', // custom meta key for displaying, in my case: the newest ...


0

I figured out the answer, since I am registering my taxonomy as phototype I simply have to create a file named taxonomy-phototype.php and inside that I will get the data by looping like I normally would in wordpress <?php if (have_posts()): ?> <?php while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php ...


1

There is only one default term in Wordpress, that is the term uncategorized from the taxonomy category. This term is created when Wordpress is first installed. This term's ID will always be 1 if it is not altered in any other way by some custom code from a custom theme or plugin. Term ids, like post ids, are very reliable and does not change within a ...


0

You have lot of issues here; Never ever use query_posts, it breaks the main query and page functionalities. You are breaking and nullifying the main query even before query_posts can have a change to do it in this line $wp_query= null As this is a shortcode (taken from your comments) and with this line, 'posts_per_page' => $num,, I believe that you ...


0

You can use this code for getting number of posts in a taxonomy: $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'your-taxonomy-name', 'field' => 'slug', 'terms' => 'some-slug', ) ) ); $query = new ...


0

maybe somethink like : $artists = get_the_term_list( $post->taxonomies, 'artist' ); unset($artists[$key]); // don't know the context, but get the term, and remove it from the array $args=array( 'tax_query' => array( array( 'taxonomy' => 'artist', 'field' => 'id', 'terms' => $artists ...


0

Use post__not_in in your query. $query = new WP_Query(array('post_type' => 'sculptures', 'post__not_in' => array($currentID), 'artist' => get_the_term_list( $post->taxonomies, 'artist' )));



Top 50 recent answers are included