Displaying posts from a custom category

The documentation for WP_Query is the place to look for this 🙂 In particular, you’re after the taxonomy query parameters. Adding a tax_query to your code will look like this: $rate_query = new WP_Query( array ( ‘post_type’ => ‘movies’, ‘posts_per_page’=>’5’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘movie_genre’, ‘field’ => ‘slug’, ‘terms’ => array( ‘movie-genre-2’ ), … Read more

Multi level archive

This is a direction. Not tested but you have an idea. <?php // get current term $term = get_term_by( ‘slug’, get_query_var(‘term’), get_query_var(‘taxonomy’) ); // get parent term $parent = get_term($term->parent, get_query_var(‘taxonomy’) ); // get children $children = get_term_children($term->term_id, get_query_var(‘taxonomy’)); $taxonomy = ‘business-types’; if ( empty($parent->term_id) ) { echo ‘<a href=”‘ . esc_url( get_term_link( $term ) … Read more

Get the terms of a post

Solved I’ve solved it by myself. The WordPress function get_the_term_list() returns the terms of the post, but unfortunately they are in the reversed hierarchical order, so I had to turn them around. $id = get_the_ID(); $terms = get_the_term_list( $id , $taxonomy , ” , $randomstring ); $terms_array = explode( $randomstring , $terms ); $terms_string = … Read more

Custom Taxonomy – Dropdown

It’s easy if you want to use a different taxonomy. Just change the ‘category’ value below to whatever your taxonomy name is. <?php wp_dropdown_categories( array( ‘taxonomy’ => ‘category’, ) ); ?> For additional parameters, see the full list on the WordPress Codex.

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