Display featured posts for a custom post type by taxonomy

If you don’t need a “tag”, I have seen “Featured” items be featured by some a post meta key. I always need a way to feature items, so yesterday I wrote a plugin that will add a metabox to any post type you’d like, with a simple checkbox. Also has columns and quickedit capabilities.

https://github.com/helgatheviking/Featured-Item-Metabox

Then I think you ought to be able to combine a Tax Query with a Meta Query. Pulling the taxonomy and term names of your current archive from the query like so:

$args = array(
    'posts_per_page' => 5,
    'tax_query' => array(
        array(
            'taxonomy' => get_query_var('taxonomy'),
            'field' => 'slug',
            'terms' => get_query_var('term')
        )
    ),
    'meta_query' => array(
           array(
               'key' => '_featured',
               'value' => 'yes'
           )
    )
);

$the_query = new WP_Query( $args );

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