shortcode and custom taxonomy wordpress

Solutions on MaxInterview for shortcode and custom taxonomy wordpress by the best coders in the world

showing results for - "shortcode and custom taxonomy wordpress"
María Paula
06 Mar 2018
1add_shortcode('list_portfolios', function ($atts) {
2    $atts = shortcode_atts(
3        array(
4            'slug' => '',
5        ), $atts, 'list_portfolios');
6
7    $args = [
8        'post_type' => 'portfolio',
9        'tax_query' => array(
10            array(
11                'taxonomy' => 'danh-muc-san-pham',
12                'field' => 'slug',
13                'terms' => $atts['slug'],
14            )
15        ),
16    ];
17    
18    $query = new WP_Query($args);
19
20});