Is it possible to create a shortcode that will query a post based on taxonomies?

here is a simple shortcode that can handle taxonomies, post types and any other parameter that WP_Query takes:

add_shortcode('posts','posts_shortcode_handler');
function posts_shortcode_handler($atts, $content){
    extract(shortcode_atts(array(
        'posts_per_page' => '5',
    ), $atts));

    global $post;
    $temp = $post;

    $posts = new WP_Query($atts);
    $retVal="";
    if ($posts->have_posts()){
        while ($posts->have_posts()){
            $posts->the_post();

            // these arguments will be available from inside $content
            $parameters = array(
                'PERMALINK' => get_permalink(),
                'TITLE' => get_the_title(),
                'CONTENT' => get_the_content(),
                'CATEGORIES' => get_the_category_list(', '),
                'THUMBNAIL' => get_the_post_thumbnail()
            );

            $finds = $replaces = array();
            foreach($parameters as $find => $replace){
                $finds[] = '{'.$find.'}';
                $replaces[] = $replace;
            }
            $retVal .= str_replace($finds, $replaces, $content);

        }
    }
    wp_reset_query();
    $post = $temp;
    return $retVal;
}

usage:

[posts post_type="page" posts_per_page=5 taxonomy_name="taxonomy_term"]
    <h5><a href="https://wordpress.stackexchange.com/questions/47895/{PERMALINK}">{TITLE}</a></h5>
    <div>{THUMBNAIL} <br />{CONTENT}</div>
[/posts]

replace page with your post type name, taxonomy_name with your taxonomy name and taxonomy_term with the taxonomy term

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