New answers tagged

1

You cannot query users by taxonomy. You will need to rethink your system. What would I do? Keep the taxonomies but use these only to output choosable values - wp_dropdown_categories() Save the selected value AS user meta, NOT AS taxonomies - update_user_meta() Now you can query users by that value - WP_User_Query() Example: This code would go to the ...


0

Problem was that I had broken the permalink structure for the CPT with the following filter: function classes_permalink_structure($post_link, $post, $permalink, $sample) { if (strpos($permalink, '%classes_class_type%') === FALSE) return $permalink; // Get post $post = get_post($post_id); ...


0

Yo don't need to write a plugin for that - what you need already exists. Check this link: https://wordpress.org/plugins/list-categories/ With this plugin you can display categories in any post or page. Of course, maybe you want to write your own plugin, and in that case this link can be helpful. I hope that this will help you to speed up a process.


0

I've modified your code to reflect the wp_list_categories() function reference as suggested by @Usce. This snippet will create an unordered list, remove the "Categories" list title, and add the li class with individual category ID so you can target each link in the list. function catting ($atts, $content = null) { echo '<div id="cats" ...


-1

There is build in wordpress function for that , so you can use wp_list_categories() for that. Please refer here to learn more And after you display them you an do some CSS if you want to display it as buttons. I hope this helps. Kind regards, Usce


1

First, I'd extract all the slugs of the recommended colour terms with something like this: $recommended_colours = wp_get_post_terms($post->ID, 'recommended_colours'); $recommended_colour_slugs = array_map(function($colour) { return $colour->slug; }, $recommended_colours); ... which leaves you with a $recommended_colour_slugs array that looks ...


0

SOLVED I found the answer in another post that was answered by @Gustav for anyone looking a solution like you can follow the link or view the code below it works perfectly. http://wordpress.stackexchange.com/questions/123059/list-post-from-current-taxonomy-children THE WORKING CODE <?php $term_slug = get_query_var( 'term' ); ...


0

@darrinb I have solved the problem. Your code helped me a lot although had a error. :) The error was getting the 'terms': $terms = get_terms( array( 'taxonomy' => $taxonomy->name, 'hide_empty' => true, ) ); Following the codex: The correct way is the following: $arg = array( 'hide_empty' => true, ...


1

Try this: <?php $object = 'post'; $output = 'objects'; $taxonomies = get_object_taxonomies( $object, $output ); $exclude = array( 'post_tag', 'post_format' ); if ( $taxonomies ) { foreach ( $taxonomies as $taxonomy ) { if( in_array( $taxonomy->name, $exclude ) ) { continue; } $terms = get_terms( array( ...


0

Just use strip_tags <?php echo strip_tags(get_the_term_list( $post->ID, 'CUSTOM-TAXONOMY', ' ',', ')); ?>


0

For the archive by the term, you should go with taxonomy template. For you it will be taxonomy-project.php When you work with custom post type , you should update the permalink structure when you make changes on templates, I mean register new post type or create new template file


0

You should you this plug in instead: Category Image And don't be shy learning and using printf, it's worth. printf( '<a class="%1$s" href="%2$s"><img class="img-class" src="%4$s" <h3>%3$s</h3></a>', sanitize_html_class( $class_name ), get_tag_link( $tag->term_id ), sprintf( __( '%s') , $tag->name ), ...


0

You can use wp_list_categories() and pass in your custom taxonomy as an argument like so: $args = array( 'taxonomy' => 'locations', 'orderby' => 'name', 'hide_empty' => false, 'show_count' => false, 'pad_counts' => false, 'hierarchical' => true, 'title_li' => '' ); ?> <ul> ...


-3

I used the content views plugin to make the list ( https://www.contentviewspro.com/ ) and then just put in short codes for each category list, separated by headings. You can see the result here: http://leakagemanagement.dk/white-papers-and-reports/ All the best Michael


0

What is wrong here is your assumptions that the values should be the same. I don't know of the top of my head what exactly the term count represent, and it is not apparent from the docs, but it is most likely a raw number of posts associated with the term. OTOH wp_query (which is used for the main loop) takes into account user permissions on top of that raw ...


0

After banging my head for hours, I found this plugin very helpful. https://wordpress.org/plugins/custom-post-type-permalinks/ Below is the screen shot of options it gives.


0

If custom taxonomy makes sense to you as approach to organization of data, but not as interface workflow then you should consider building custom interface for it. Some frameworks out there can work with native taxonomies, but provide alternate interfaces for them. So you might even find something fitting already done. The more low key approach I can ...



Top 50 recent answers are included