• Is there any way to make the category pages include in a search?

    I created a site with many categories, it is in fact mostly categories, and I want to make the categories searchable, but I cannot figure out how to do it.

    For example, if you go to https://miniphylo.mdd.li and do a search for ‘Firmicutes’, ideally the top result should be the category page for Firmicutes, but it isn’t, it is posts that are contained within that category.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter mikedacre

    (@mikedacre)

    I manged to figure out how to do this, so I have one more question:

    – Is there a way to get the excerpt for an Enhanced Category Page? Right now if you go to the Firmicutes search results, I have the category at the top, but I can’t figure out how to show an excerpt.

    Current code:

    $terms = get_terms( 'category', array(
        'name__like' => $s,
        'hide_empty' => true // Optional
    ) );
    if ( count($terms) > 0 ){
        echo '<h1 style="padding: 20px 0 0 20px;">Taxa</h1>';
        foreach ( $terms as $term ) {                                                                                                                                                                                   
            // echo $term;
            $child = $term->name;
            $url = esc_url( get_term_link( $term ) );
            echo '<article class="entry entryTypePostExcerpt">';
            echo '<div class="entryContainer">';
            echo '<div class="entryHeader">';
            echo "<h2 class='entryTitle'>".$child."</h2>";
            echo '</div>';
            echo '</div>';
            echo '</article>';
        }
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Search Enhanced Category Pages?’ is closed to new replies.