• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Hastimal Shah

Wordpress Developer & Consultant

  • Facebook
  • GitHub
  • Google+
  • LinkedIn
  • Twitter
  • Home
  • About
  • Contact

Genesis Framework Custom Search Template With Custom Post Type

November 6, 2016 by Hastimal Shah 6 Comments

Genesis Framework Custom Search Template which includes the custom post type and forces the different layouts available in framework.

While working on one of the theme development project using Genesis Framework. The client requested a different type of search results layout which includes the CPT (Custom Post Type) .

Here is the Solution

In Genesis Child Theme, Create the search.php file and remove the Genesis Standard Loop and write your own custom loop which includes the CPT (Custom Post Type) in my project it was Article & Videos and display the end result as needed.

Final Result Look like below image.

custom-search-result-genesis-framework

STEP 1 : Create Custom Search Template

Create the file named search.php in child theme directory having the below code:

Forcing The Layout – Line number 10 to 20 contains code for all layout options available, current full-width template is enabled here.
Just un-comment the layout code that you would like to use.

Custom Post Type & Order – Line number 35 contains code for post types included in desired order for the search result.

Much More You can do with above template code

  1. Remove The Post Information – Line no 54
  2. Remove The Post Featured Image – Line no 57
  3. Remove The Post Content – Line no 60
  4. Remove Post Content Nav – Line no 63 & 64
  5. Modify The Content Limit – Line no 67
  6. Modify The Content Limit Read More Link – Line no 70
  7. Force Excerpt Content – Line no 73
  8. Modify The Excerpt Limit Read More Link – Line no 76
  9. Remove The Post Meta Information – Line no 82 to 84
  10. Remove The archive Pagination – Line no 87

Before doing anything mentioned in above list you should be aware of what you are doing.

Filed Under: Genesis Tagged With: genesis custom search template, Search, search-template

Reader Interactions

Comments

  1. BW says

    February 28, 2019 at 10:57 pm

    This is a great search page template! I’ve just got one issue bugging me – when allowing archive pagination (by commenting out line 87) the pagination shows up, but the pagination doesn’t work. It looks like there’s no handling of pagination built into this template.

    Reply
    • Brent says

      February 25, 2020 at 3:30 am

      If someone has a pagination example online that works with this code here please point me to it.

      Reply
  2. Debi Thompson says

    September 4, 2019 at 11:44 pm

    Hi! Is it possible to expand this code to have 3 different search loops, based on the post_type? We need a global search based on posts/pages only, a blog search based on posts only, and a custom search based on a custom post_type (resource).
    Perhaps If statements for each based on page/post and/or page_id within the search.php? Would that work? Or maybe you may have a different approach to resolve?
    Your assistance is greatly appreciated!
    Deb

    Reply
    • Hastimal Shah says

      September 5, 2019 at 12:06 am

      Yeah we can have three different search loops., but why you need that way when in single query we can search from all.
      Can you please let me know so i can help you.
      Hasti

      Reply
      • Debi Thompson says

        September 5, 2019 at 12:30 am

        The project is to have the post/page search form on the search page available from the header above the global nav (this is the one that is active). The second search form (posts only) is to be found on the blog pages next to the blog nav. The third search form is for a new custom post type (resource) to be found on an archive page to be built for that post type. This is for a resource library of assorted media to be available to visitors, but the search is separate from posts and pages in the global/blog search.
        Thank you!

        Reply
  3. Floyd says

    December 8, 2019 at 4:07 am

    Excellent post

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer

Subscribe & Get Blog Updates via Email

Enter your email address to subscribe & get notifications of new tutorials by Email.

Recent Posts

  • Enable Divi Builder For Custom Post Type
  • What is Accelerated Mobile Page?
  • Genesis Framework Custom Search Template With Custom Post Type
  • Dreams come true of Writing / Sharing my knowledge

Pages

  • Request for Tutorials
  • Contact
  • About

© Copyright 2016 Genesis Sample Theme on Genesis Framework