Jake Vanderwerf
2026-02-10 8c4279f9bbe7ec4681412865b999f2f4457d80ac
content/faq.php
@@ -8,6 +8,9 @@
        'dash_description' => 'Manage your answers',
        'capability_type' => ['faq', 'faqs'],
        'breadcrumb'    => 'FAQ',
        'addCrumb'      => 'section',
        'show_directory'=> true,
        'directory_extra'=> ['section'],
        'dash_title'    => 'FAQs',
        'icon'         => 'question',
        'rewrite_taxonomy' => 'section',
@@ -156,32 +159,3 @@
//        $output = wp_add_inline_script('jvb-form', $script, 'after');
    }
}
add_filter('jvbBreadcrumbs', 'altrFAQCrumbs');
function altrFAQCrumbs(array $crumbs) {
    if (is_singular(BASE.'faq')) {
        $ID = get_the_ID();
        $terms = get_the_terms($ID, BASE.'section');
        if ($terms && !is_wp_error($terms)) {
            $last = array_pop($crumbs);
            $term = $terms[0];
            $ancestors = get_ancestors($term->term_id, BASE.'section', 'taxonomy');
            $ancestors = array_reverse($ancestors);
            foreach ($ancestors as $ancestor) {
                $aTerm = get_term($ancestor, BASE.'section');
                if ($aTerm && !is_wp_error($aTerm)) {
                    $crumbs[] = [
                        'name' => $aTerm->name,
                        'url'   => get_term_link($ancestor, BASE.'section')
                    ];
                }
            }
            $crumbs[] = [
                'name' => $term->name,
                'url'   => get_term_link($term, BASE.'section')
            ];
            $crumbs[] = $last;
        }
    }
    return $crumbs;
}