WP Tax query & order by tax query not working

Here’s an example of working tax_query. The problem I’ve run into with tax_query is forgetting to nest the array (i.e. ‘tax_query’ is array(array(…)). If you don’t do that, it does not work. $args = array( ‘post_type’ => $post_type, ‘posts_per_page’ => -1, //show all posts ‘tax_query’ => array( array( ‘taxonomy’ => $taxonomy, //’field’ => ‘slug’, //’terms’ … Read more

How to limit custom post category

Use array_slice and get the first 5 elements of the array: <?php $term_id =182; $taxonomy_name=”geram_category”; $term_children = get_term_children( $term_id, $taxonomy_name ); $term_children = array_slice( $term_children, 0, 5, true ); foreach ( $term_children as $child ) { $term = get_term_by( ‘id’, $child, $taxonomy_name); echo ‘<li><a href=”‘ . get_term_link( $child, $taxonomy_name ) . ‘”>’ . $term->name . … Read more

Custom TaxonomyTemplate

Create a page with slug ‘brand’. Then create a custom page template and write required loop to return the terms of the ‘brand’ taxonomy. Assign that page template to ‘Brand’ page. Visit this codex page to know how to code a page template. And here is an example of how to list terms of custom … Read more

Country-specific content

Creating a multisite would be the most efficient approach in this scenario. You could have a structure like this: —> example.com —> example.com/chile —> example.com/argentina —> example.com/mexico The benefit of a multisite is that it’s easy to separate all your content from the beginning. And you can use a plugin like Multisite Post Duplicator to … Read more

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