Thứ Hai, 8 tháng 5, 2017

Hiển thị list tag woocommerce ra ngoài

function get_some_tags_man(){
    $terms = get_terms( array( 
        'hide_empty' => false, // only if you want to hide false
        'taxonomy' => 'product_tag',
     ) 
    );
    $html = '';
    if($terms){
        $html .= '<select name="terms" id="someID">';
        foreach($terms as $term){
            $html .= "<option name='$term->name'>$term->name</option>";
        }
        $html .= '</select>';
    }
    return $html;
}
<?php echo get_some_tags_man(); ?>

Không có nhận xét nào:

Đăng nhận xét