/*
Theme Name: Stoni Child
Author: WebGeniusLab
Author URI: http://webgeniuslab.net
Description: -
Version: 1.0
Template: stoni
Text Domain:  stoni-child
*/

$query = array(
    'orderby' => 'meta_value_num',
    'order' => 'ASC',
    'meta_query' => array(
        'relation' => 'OR',
        array(
            'key' => 'portfolio_order',
            'compare' => 'NOT EXISTS'
        ),
        array(
            'key' => 'portfolio_order',
            'value' => 0,
            'compare' => '>='
        )
    ),
    'hide_empty' => true,
    'parent' => 0
);
$terms = get_terms( 'portfolio-category', $query );
if( ! empty( $terms ) ) {
    echo '<ul>';
    foreach( $terms as $term ) {
        printf( '<li><a href="%s">%s</a></li>', esc_url( get_term_link( $term, 'portfolio-category' ) ), esc_html( $term->name ) );
    }
    echo '</ul>';
}