Get first category only and excluding one

Within the post loop you can do, $category = get_the_category(); if($category[0]->cat_name == “featured”) { //if first category in array is “featured”, get next category in line $name = $category[1]->cat_name; $cat_id = get_cat_ID( $name ); $link = get_category_link( $cat_id ); echo ‘<a href=”‘. esc_url( $link ) .'””>’. $name .'</a>’; } else { //get the first category … Read more

Call function on a single page

Assuming your function runs generally, to limit it to a specific page use if( is_page( 2094 ) ) { add_filter(“sjb_job_location_filter_args”,”exclude_jobs_locations_uk”); } The location of the function definition doesn’t matter. P.S. Regarding excluding categories . . . yeah, we’d need to know a lot more about what’s going on with the called (plugin?) function

Exclude a ‘portfolio’ custom category?

Please take a look at this example; $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘movie_genre’, ‘field’ => ‘slug’, ‘terms’ => array( ‘action’, ‘comedy’ ) ), array( ‘taxonomy’ => ‘actor’, ‘field’ => ‘id’, ‘terms’ => array( 103, 115, 206 ), ‘operator’ => ‘NOT IN’ //you must set the … Read more

Cannot exclude particular post from loop of custom post type

Something like this should work from your functions file as long as you use the correct conditional tag for your CPT archive: function exclude_single_post_cpt($query) { if (is_post_type_archive(‘event’) && $query->is_main_query() && !is_admin() ) { $query->set(‘post__not_in’, array(1646)); } } add_action(‘pre_get_posts’, ‘exclude_single_post_cpt’);

show 10 most recent custom post types excluding the one(s) from specific custom taxonomy

Firstly, your tax query is a little jumbled. The first nested array should actually be at the ‘root’ of your query_posts() argument, with tax_query as a key among them; array( ‘post_type’ => ‘review’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 10, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘reviewcats’, ‘terms’ => array( ‘featured’ ), ‘field’ … Read more

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