Show the terms of the hierarchical taxonomy

The issue you’re facing is due to the hierarchical structure of your taxonomy terms. The get_term_by() function expects a single term name as the second parameter, but in your case, the term name is an array because of the hierarchical structure.

To resolve this issue, you can modify your code to this:

$tipi_evento_names = dci_tipi_evento_array();

?>

<div class="container py-5">
    <h2 class="title-xxlarge mb-4">Esplora per categoria</h2>
    <div class="row g-4">
        <?php
        foreach ($tipi_evento_names as $parentName => $childArray) {
            // Get the parent term
            $parentTerm = get_term_by('name', $parentName, 'tipi_evento');
            $parentTermId = $parentTerm->term_id;
            $parentTermLink = get_term_link($parentTermId, 'tipi_evento');
        ?>
        <div class="col-md-6 col-xl-4">
            <div class="cmp-card-simple card-wrapper pb-0 rounded border border-light">
                <div class="card shadow-sm rounded">
                    <div class="card-body">
                        <a class="text-decoration-none" href="<?php echo $parentTermLink; ?>" data-element="service-category-link">
                            <h3 class="card-title t-primary"><?php echo $parentTerm->name; ?></h3>
                        </a>
                        <p class="text-secondary mb-0">
                            <?php //echo $parentTerm->description; ?>
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <?php
            // Iterate over child terms
            foreach ($childArray as $childName => $grandchildArray) {
                // Get the child term
                $childTerm = get_term_by('name', $childName, 'tipi_evento');
                $childTermId = $childTerm->term_id;
                $childTermLink = get_term_link($childTermId, 'tipi_evento');
        ?>
        <div class="col-md-6 col-xl-4">
            <div class="cmp-card-simple card-wrapper pb-0 rounded border border-light">
                <div class="card shadow-sm rounded">
                    <div class="card-body">
                        <a class="text-decoration-none" href="<?php echo $childTermLink; ?>" data-element="service-category-link">
                            <h3 class="card-title t-primary"><?php echo $childTerm->name; ?></h3>
                        </a>
                        <p class="text-secondary mb-0">
                            <?php //echo $childTerm->description; ?>
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <?php
                // Iterate over grandchild terms
                foreach ($grandchildArray as $grandchildName) {
                    // Get the grandchild term
                    $grandchildTerm = get_term_by('name', $grandchildName, 'tipi_evento');
                    $grandchildTermId = $grandchildTerm->term_id;
                    $grandchildTermLink = get_term_link($grandchildTermId, 'tipi_evento');
        ?>
        <div class="col-md-6 col-xl-4">
            <div class="cmp-card-simple card-wrapper pb-0 rounded border border-light">
                <div class="card shadow-sm rounded">
                    <div class="card-body">
                        <a class="text-decoration-none" href="<?php echo $grandchildTermLink; ?>" data-element="service-category-link">
                            <h3 class="card-title t-primary"><?php echo $grandchildTerm->name; ?></h3>
                        </a>
                        <p class="text-secondary mb-0">
                            <?php //echo $grandchildTerm->description; ?>
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <?php
                } // End grandchild loop
            } // End child loop
        } // End parent loop
        ?>
    </div>
</div>

I have added nested loops to iterate over the hierarchical array. The first loop retrieves the parent terms, the second loop retrieves the child terms, and the third loop retrieves the grandchild terms.

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino