admin管理员组

文章数量:1312978

In my wordpress functions.php, I have tried increasing locations position count in the breadcrumb from 2 and above in the foreach loop (while leaving out position 1 for Homepage).

Please how can I be able to achieve this? All suggestions are highly appreciated.

Below is what I tried

function zuluma_display_breadLocation($pid) {
    global $zuluma_theme;
    $ad_country = '';
    $type = '';
    $type = $zuluma_theme['cat_and_location'];
    $ad_country = wp_get_object_terms($pid, array('ad_country'), array('orderby' => 'ASC'));
    $all_locations = array();
    foreach ($ad_country as $ad_count) {
        $country_ads = get_term($ad_count);
        $inc = 1;
        $item = array(
            'term_id' => $country_ads->term_id,
            'location' => $country_ads->name
        );
        $all_locations[] = $item;
    }
    $location_html = '';
    if (count($all_locations) > 0) {
        $limit = count($all_locations) - 1;
        for ($i = $limit; $i >= 0; $i--) {
            if ($type == 'search') {
                $sb_search_page = apply_filters('zuluma_language_page_id', $zuluma_theme['sb_search_page']);
                $location_html .= '<li itemprop="itemListElement" itemscope itemtype=";><a href="' . get_the_permalink($sb_search_page) . '?country_id=' . $all_locations[$i]['term_id'] . '"><span itemprop="name">' . esc_html($all_locations[$i]['location']) . '</span></a><meta itemprop="position" content="$inc++;" /></li>';
            } else {
                $location_html .= '<li><a href="' . get_term_link($all_locations[$i]['term_id']) . '">' . esc_html($all_locations[$i]['location']) . '</a></li>, ';
            }
        }
    }
    return rtrim($location_html, ', ');
}

The below is what i got when i view the source code

<meta itemprop="position" content="$inc++;" />

本文标签: pluginsHow Can I Increase Breadcrumb Position Count (Starting From 2)