global $porto_settings;
wp_reset_postdata();
$use_theme = false;
if ( have_posts() ) :
the_post();
// Pega o primeiro termo com segurança
$terms_raw = wp_get_post_terms( get_the_ID(), 'porto_builder_type', array( 'fields' => 'names' ) );
$terms = is_wp_error( $terms_raw ) ? array() : (array) $terms_raw;
$term0 = $terms[0] ?? ''; // string vazia se não houver termo
$is_header = ( 'header' === $term0 );
$is_footer = ( 'footer' === $term0 );
$use_theme = in_array( $term0, array( 'product', 'shop', 'archive', 'single' ), true );
$container = get_post_meta( get_the_ID(), 'container', true );
if ( ! $container ) {
if ( $is_header ) {
$container = ( isset( $porto_settings['header-wrapper'] ) && 'wide' === $porto_settings['header-wrapper'] ) ? 'fluid' : '';
}
}
// era: if ( 'shop' == $terms[0] ) { ... }
if ( 'shop' === $term0 ) {
echo '';
if ( ! empty( $porto_settings['product-archive-filter-layout'] ) && 'default' !== $porto_settings['product-archive-filter-layout'] ) {
wp_enqueue_style(
'porto-shop-filter',
PORTO_CSS . '/theme/shop/shop-filter/' . $porto_settings['product-archive-filter-layout'] . ( is_rtl() ? '_rtl' : '' ) . '.css',
array(),
PORTO_VERSION,
'all'
);
}
}
if ( $use_theme ) {
get_template_part( 'header/header_before' );
}
if ( $is_header ) {
$is_side = get_post_meta( get_the_ID(), 'header_type', true );
echo '