• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Remove CPT Entry Header and Footer on Search Results

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove CPT Entry Header and Footer on Search Results

This topic is: not resolved

Tagged: entry_footer, entry_header, genesis_post_info, genesis_post_meta, remove_action

  • This topic has 4 replies, 3 voices, and was last updated 8 years, 6 months ago by hortonsart.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • March 15, 2016 at 1:46 pm #181470
    hortonsart
    Member

    I'm building a site using a couple of different Custom Post Types (CPT). I've created single templates for these CPT and have removed the entry header post info and entry footer meta and the markup for the entry header and entry footer from displaying.

            remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
            remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
            remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
            remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
            remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
            remove_action( 'genesis_entry_footer', 'genesis_post_meta' );

    For some reason when I use the search form and perform a search these results come up, along with other blog posts, and the entry header and footer information shows up again. Is there another template that I need to modify to not display this information on search results for these CPT?

    Any help is greatly appreciated.

    March 16, 2016 at 6:57 am #181527
    Victor Font
    Moderator

    Unless your theme has a search.php file, it is using the default WordPress search results page. You can create your own search results page and customize it any way you'd like: https://codex.wordpress.org/Creating_a_Search_Page


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    March 17, 2016 at 1:52 pm #181726
    hortonsart
    Member

    Thanks Victor. I guess I'm not understanding, or maybe were talking about two different things? The post types that are included in the search results are fine. I want the custom post types, pages and posts to show up in the results and they are. What I don't want is the entry header (post info) and entry footer (post meta) to be displayed on the results of my custom post types when being displayed in the search results, because they're more like pages (It doesn't matter what category they belong to, what date they were published, or which author actually published the custom post type etc.). I thought removing these items through their respective custom post type single templates would carry over into the search results?

    For example let's say I have the following Post Types
    - Pages
    - Posts
    - Products (Custom Post Type with entry_header_markup, post_info, entry_footer_markup, and post_meta removed in the single template -> single-products.php)

    Let's also say I've written a blog post that references one of these "Products" in its body. When I perform a search I get the blog post I wrote and the "product" posting in the results. This is great and what I want to happen, but both results are now being displayed with the date and the author and the number of comments, which is fine for a blog post because those elements are important, but I've removed those elements on the Products postings because that information doesn't matter.

    For the time being I've just removed this info via CSS. If anyone knows a better way to do this please let me know.

    October 26, 2016 at 1:56 pm #195365
    H
    Participant

    Did you salve this @hortonsart? I want to do the exact same thing and haven't found any solution.

    October 26, 2016 at 4:36 pm #195374
    hortonsart
    Member

    Hi Josh, I opted for a CSS approach to solve this problem by targeting the body class of "search" and the post class for my cpt to hide the entry meta.

    
    .search .your-custom-post-type-class-here .entry-meta {
        display: none;
    }

    All searches on your site should have a body class of "search" by default and all of your custom post types should have a custom post class by default as well. Let me know if you run into any problems.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble