Questions tagged [taxonomy-terms]

3

votes
1

answer
17

Views

Exclude a product category from Related products in WooCommerce

I am trying to exclude a product category (id: 78) from the related products section in WooCommerce. I have a custom query already in place which only shows related products from the child category. This is my code:
dwinnbrown
1

votes
1

answer
320

Views

Display custom taxonomy only if is not empty

I have BOOKS INFOBOX like this: Data Buku then I create genre field used by Simple Taxonomy Plugin, and I get code to display like this: My problem, how I put genre field code in BOOKS INFOBOX, and if blank data so genre field do not show?
PUSTAKAKORAN.COM
1

votes
1

answer
4.5k

Views

Wordpress: tax_query multiple terms using OR operator

Simple query but for some reason is not displaying the correct posts, trying to display a post with the monthly-to-do-list term, if no results then display a post with the community-events' term. Any suggestions? $todo_args = array( 'cat' => $my_category_id, 'posts_per_page' => 1, 'tax_query' => arr...
Jose Salazar
1

votes
2

answer
692

Views

How can exclude term from get_terms by term name not by term id

My code below. It does not work to delete using the terms. I need it to work like this and not delete by ID. $terms = get_terms( 'MY_TAXONOMY', array( 'orderby' => 'name', 'order' => 'ASC', 'exclude' => array(), ) ); $exclude = array('MY TERM', 'MY TERM 2', 'MY TERM 3'); $new_the_category = '';...
J.Z
6

votes
4

answer
1.6k

Views

Display the terms or product attributes for a specific product category(woocommerce)

I have been researching all over the net and forums regarding my question but I can't seem to produce the correct results. Basically I'm trying to display the terms or product attributes for only a specific product category. Here is the code I have been working on.
clestcruz
3

votes
1

answer
2.5k

Views

Uncaught Error: Cannot use object of type WP_Term as array

I had this issue since I updated my WordPress, in my website I have a custom post which contains some custom categories, something like that: 1) Parent category: Food | Child: Fries, Hamburger, Maple Syrup… 2) Parent category: Year | Child: 2016, 2015, 2014… 3) Parent category: Country | Child:...
cbtr
2

votes
2

answer
103

Views

over 20.000 taxonomy category issue - wordpress

I'm using wordpress. And have inserted over 20.000 product categories but now the page where I'm showing all categories is down and not available. Even in the backend - after some amount of categories, I can't see rest. And I see following errors: Fatal error: Allowed memory size of 268435456 bytes...
aiddev
2

votes
1

answer
296

Views

Wordpress - Advanced Custom Fields - Category Images wrong for Widgets

I am using Advanced Custom Fields to return the url location of Category images. Which would allow me to add the Category image before the title of the post. I have a function insert_image_before_title in my functions.php file which is referenced by a title filter (see below). So this seems to work...
truk
2

votes
1

answer
20

Views

On taxonomy page, show posts associated with that taxonomy and another

I have a custom post type called Developments. They are buildings. They have two different taxonomies: City and Status. On the City taxonomy page for one of the buildings I'm trying to show all posts associated with the Status taxonomy. $dev_name This code outputs all of the Status terms, but it's s...
Darren Bachan
2

votes
2

answer
2.4k

Views

Excluding Specific Terms from WP_Query

I would like to create a foreach loop for taxonomy terms which is for custom post type. More specifically I want a loop that queries all the products categories, but not the category 'special-offers' and not categories subcategories. Bonus would be if, product has no category query them too and orde...
Jack
2

votes
2

answer
689

Views

wp_list_categories() - display first level categories and only current term's children in subcategory page

I'm using WordPress. Have multiple categories with its subcategories. In general page, I'm displaying all first level categories. Here is my code: $args = array( 'type' => 'product-items', 'child_of' => 0, 'parent' => '', 'order' => 'DESC', 'hide_empty' => 0, 'hierarchical' => 1, 'exclude' => '',...
aiddev
2

votes
2

answer
404

Views

How to show more than 1 custom taxonomy term or link on a custom post type?

I have created a custom taxonomy called 'tema' and the taxonomy has three terms. I want to show ALL the term links that are related to the current post. Currently I can only get my code to show ONE of the posts taxonomy terms... I would like the term links displayed via my custom content.php file ('...
MariaThiim
2

votes
3

answer
205

Views

Wordpress - taxonomy used on multiple post types - how to get_terms / get_categories for just one?

I have registered taxonomies for multiple post types thinking this was the best way to set the site up rather than have the same taxonomies duplicated. However, now I have run into an issue where I need to list the used taxonomies for a post type but its listing taxonomies for all both types. Ho...
LeeTee
2

votes
1

answer
102

Views

WP_Term_Query - How to search only beginning of term name?

I'm building a WordPress autocomplete search which uses custom taxonomy terms as suggestions, and I'm using WP_Term_Query to query for the terms from what the user types in the search field. WP_Term_Query has a parameter called 'search' which according to the documentation uses the search criteria t...
Joe
1

votes
5

answer
2.4k

Views

get_terms() orderby name is not working - wordpress

I'm using wordpress, want first-level taxonomy terms to be ordered by name but below code is not giving me desired result. Here is my code: $args = array( 'taxonomy' => 'tax-category', 'hide_empty' => 0, 'hierarchical' => 1, 'parent' => 0, 'orderby'=>'name', 'order' => 'DESC', 'fields' => 'all', );...
aiddev
3

votes
2

answer
3.3k

Views

Wordpress - Get tag id by slug

I am trying to get id\name of tag by it slug. Thats my code: $tag = get_term_by('slug', 'hedoms', 'post_tag'); $tag_id = $tag->term_id; I took it from here: https://codex.wordpress.org/Function_Reference/get_term_by I have tag with the slug hedoms but the is empty, it not returns the value. I have...
Oshrib
1

votes
1

answer
37

Views

Wordpress taxonomy query with both and , or condition

i have product post type and i have product_cat is the taxonomy . In product_cat i have red, hard, soft, pen entires . So i have to get the products coming under red and it coming hard or soft How can i get this ? For a product that come under both red and hard and soft i can use the following...
abilash er
0

votes
0

answer
69

Views

Group posts by categories in custom taxonomy archive page

I have a custom taxonomy that is called colture and I am working on its archive template. The pages correctly display the posts of every term of the taxonomy 'colture'. Now I need to group them by default categories top-levels (there are 3 top levels) within the single term 'colture' pages. I just n...
Davide Giorgetta
0

votes
1

answer
213

Views

Custom Taxonomy Terms in Custom Post Type Slug

We have the following arrangement for a housing website which has plots (aka houses) which are grouped into developments. So, the actual structure might look like this WINDY HILLS 1 Sunnydale Road 2 Sunnydale Road 10 Sunnydale Road SUDDEN VALLEY 1 Sudden Valley 2 Sudden Valley The slug I would like...
mike_freegan
1

votes
1

answer
485

Views

Custom post type, sort taxonomy terms by a meta box value

I've have created a custom post type with a taxonomy. I need to sort the taxonomy posts by a meta value in my custom post type. I am using the plugin Advanced Custom Fields to insert a separate meta value field to my posts in my custom post types. So far I've been able to get posts taxonomies sort...
user3289402
0

votes
1

answer
39

Views

WordPress display only the posts who have a certain parent category

I would like to query posts based on specific category_parent id. This is used as a filtering function for the users to filter posts based on a parent category type. I have multiple categories who have multiple children categories. For example, Fruits is the parent category, then children categories...
leo277
1

votes
1

answer
577

Views

WordPress taxonomy images plugin displaying all terms

I am using taxonomy-images/ WordPress plugin (https://en-gb.wordpress.org/plugins/taxonomy-images/) Target: I have got a poster taxonomy and I would like to display term name and term image. I would like to be able to display, retrieve ALL terms in my taxonomy, no matter term name is empty. Issue: B...
fabio