This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Combining Post Type and Taxonomy Grouping

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Combining Post Type and Taxonomy Grouping Reply To: Combining Post Type and Taxonomy Grouping

#52212
melsaundersmelsaunders
Participant

Thank you for the solution provided regarding limiting the number of results; I’ll give it a try!

As for adding a link to the archive page for each post type at the end of its group, I experimented with the following code in the group-footer.php file, and it seems to be working fine:

<span>
    <?php
    $post_type = get_post_type($r->id);
    if ($post_type === 'products') {
        // If the post type is 'products', add a link to the products archive page
        echo '<a href="' . home_url('/products') . '">See All Products</a>';
    } elseif ($post_type === 'post') {
        // If the post type is 'post', add a link to the articles archive page
        echo '<a href="' . home_url('/resources') . '">See All Articles</a>';
    } else {
        // Otherwise, just display the post type
        echo esc_html($post_type);
    }
    ?>
</span>

It seems to do the trick for now. Let me know if there’s anything I should be cautious about with this approach!