Get Tags specific to Category using WooCommerce plugin

Finally solve the problem: t1.taxonomy = ‘product_cat’ AND p1.post_status=”publish” AND terms1.term_id IN (“.$args[‘categories’].”) AND t2.taxonomy = ‘product_tag’ AND p2.post_status=”publish” In the functions.php t1.taxonomy = ‘category’ AND p1.post_status=”publish” AND terms1.term_id IN (“.$args[‘categories’].”) AND t2.taxonomy = ‘post_tag’ AND p2.post_status=”publish” rename category to product_cat, and post_tag with product_tag.

How to speed up my site [duplicate]

Try using a caching plugin. There’s plenty available, the two most popular being WP Super Cache and W3 Total Cache. If you’re just starting out with caching, I’d recommend W3 Total Cache, as it is rather easy to set up and includes a lot of options. It’s even used by some of the bigger sites … Read more

custom walker wp menu last element

If you can live without re-creating the menu walker, you can add classes to menu items manually. On the WordPress menu editing screen, click on “Screen Options” and enable “CSS Classes.” Then you’ll be able to add whatever class you want to whichever list item. Creating a custom Walker for something like this will be … Read more

I would like to have different styles for my posts based on the content of each post

Depending on which ‘types’ you need, you might be looking for the Post Format functionality. It allows you to set posts as standard, quotes, galleries, etc (sort of like Tumblr). To activate it, simply toss this into your theme (probably functions.php): add_theme_support( ‘post-formats’, array( ‘aside’, ‘gallery’, ‘quote’ ) ); Then, in your templates, you’ve got … Read more

How to get grandparent of a given category

You could write a simple function to do this each time you need to. Here’s an example I found on this website. function pa_category_top_parent_id( $catid ) { while( $catid ) { $cat = get_category( $catid ); // get the object for the catid $catid = $cat->category_parent; // assign parent ID (if exists) to $catid // … Read more

Combining wordpress themes

If you are only using “a feature” of one theme, you may be better off taking your “standard” theme (the one you’d like to use throughout) and then taking the functionality from the “one-off” theme and adding it onto the former. This goes in-part with the fundamental idea of not adding such functionality to a … Read more

update_options and unique filenames

Welcome to the lions den So you’re willing to get down into the blazing furnace or the lions den and change the upload path. This is so not a good idea without investigating what is happening behind the scenes. I can’t give you a full write up, as there’s so much involved, like filters, options … Read more

custom fields wordpress

The update_user_meta and get_user_meta functions are what you want, without having to fool around with any database connections or SQL. All it takes is one include statement in your theme, and a bit of PHP magic to call the meta functions. Check out my code, which accomplished what you are trying to do, on Github … Read more

Posts in loop displaying all taxonomies

You are a victim of WordPress’ great naming scheme. You don’t need get_terms(), but get_the_terms(). Note the the? That makes a huge difference. get_terms( $taxonomies, $args=”” ): Retrieve the terms in a given taxonomy or list of taxonomies. All terms. get_the_terms( $id, $taxonomy ): Retrieve the terms of the taxonomy that are attached to the … Read more