/******* Do not edit this file *******
Simple Custom CSS and JS - by Silkypress.com
Saved: Sep 24 2025 | 01:19:50 */
function pr_categorias_alfabeticas_all( $atts ) {
    $atts = shortcode_atts( array(
        'taxonomy'   => 'product_cat', // 'category' para posts
        'hide_empty' => 'false',       // true = só categorias com produtos
    ), $atts, 'categorias_alfabeticas_all' );

    $hide_empty = ($atts['hide_empty'] === 'true' || $atts['hide_empty'] === '1') ? true : false;

    $args = array(
        'taxonomy'   => sanitize_text_field($atts['taxonomy']),
        'orderby'    => 'name',
        'order'      => 'ASC',
        'hide_empty' => $hide_empty,
        'number'     => 0, // sem limite
    );

    $terms = get_terms($args);

    if ( is_wp_error($terms) || empty($terms) ) return '<p>Nenhuma categoria encontrada.</p>';

    $html = '<div class="categorias-alfabeticas"><ul>';
    foreach ($terms as $term) {
        $link = get_term_link($term);
        if ( ! is_wp_error($link) ) {
            $html .= '<li><a href="' . esc_url($link) . '">' . esc_html($term->name) . '</a></li>';
        }
    }
    $html .= '</ul></div>';

    return $html;
}
add_shortcode('categorias_alfabeticas_all', 'pr_categorias_alfabeticas_all');
