I used the Tax-meta-class by bainternet but i still can’t get it to display any of the results.

There’s a slight catch to using bainternet’s Tax Meta Class: the way you save and retrieve data changes depending on your WordPress version. If you are using the latest version of WordPress then use get_term_meta instead of get_tax_meta. https://github.com/bainternet/Tax-Meta-Class/issues/115#issuecomment-170365995 I believe the exact version is WordPress 4.4. If your WP version is before 4.4, use … Read more

List child terms if parent but show nothing on children

For reliability, you can get the current term being viewed from the queried object from $GLOBALS[‘wp_the_query’] $current_term = sanitize_term( $GLOBALS[‘wp_the_query’]->get_queried_object() ); To answer your question, if Southern Africa is top level, it should have a parent term ID of 0. All child terms should have a numeric value as parent which corresponds to the parent … Read more

AJAX response, edit tags

Wait for WordPress 4.7 on 6th December. It has this almost built-in. If I got it right, then you’ll want to prevent some terms from deletion. I already made a snippet for that which works with WP 4.7 add_filter( ‘user_has_cap’, function ( $allcaps, $caps, $args ) { if ( ! isset( $args[0] ) || ‘delete_term’ … Read more

Wrapping result of the_terms in a span with a class of the term name

Generally speaking in the WordPress world, functions prefixed with the_ will output results immediately. Functions prefixed with get_ will return the results without outputting them. The function get_the_terms() can be used to achieve the desired results. Here’s a complete function that’s essentially a wrapper for get_the_terms() with a little bit of extra formatting: /** * … Read more

Woocommerce: How to change the add to cart text in a certain category? [closed]

You can use the has_term function to check for the desired term. function add_cart_button_replace() { global $product; $link = $product->get_permalink(); $button_text = __(‘+show OFFER’, ‘woocommerce’); // check if the current product has a “product-category” of “free-products” if(has_term(‘free-products’, ‘product_cat’, $product->get_id())) $button_text = __(‘+choose me’, ‘woocommerce’); echo do_shortcode(‘<a href=”‘.$link.'” class=”button addtocartbutton”>’ . $button_text . ‘</a>’); } You … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)