Exclude specific slug in ‘get_terms’

The get_terms() (see docs) function accepts the same args as WP_Term_Query(see docs) You have to get those terms Ids first and then pass it to the exclude arg: // default to not exclude terms $ids_to_exclude = array(); $get_terms_to_exclude = get_terms( array( ‘fields’ => ‘ids’, ‘slug’ => array( ‘graduate’, ‘job-market-candidate’, ‘graduate-student’, ‘research’ ), ‘taxonomy’ => ‘role’, … Read more

How to display post from current Taxonomy in archive page?

You will need to grab the queried object for the page and fill in your taxonomy information dynamically. if (is_tax() || is_category() || is_tag() ){ $qobj = get_queried_object(); // var_dump($qobj); // debugging only // concatenate the query $args = array( ‘posts_per_page’ => 1, ‘orderby’ => ‘rand’, ‘tax_query’ => array( array( ‘taxonomy’ => $qobj->taxonomy, ‘field’ => … Read more

get a specific taxonomy term name

Use get_term() to get the name, slug, or description: $term = get_term( 1, ‘taxonomy_slug’ ); // Name echo $term->name; // Link echo get_term_link(1, ‘taxonomy_slug’); // OR echo get_term_link( $term );

Using pre_get_posts to set posts per page, how do I?

You’re almost there mate. Try this though. <?php add_action(‘pre_get_posts’, ‘filter_press_tax’); function filter_press_tax( $query ){ if( $query->is_tax(‘press’) && $query->has_term(‘press’)): $query->set(‘posts_per_page’, 5); return; endif; } ?> You can use any conditional tag or any argument that can be passed to WP_Query to test your condition or set a new value via pre_get_posts. Also try $query->get(‘taxonomy’) / $query->get(‘term’). … Read more

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