Support » Theme: GeneratePress » Search results, 404 page

  • Resolved themedleb

    (@themedleb)


    Hi,

    How can I show only posts (not pages) in search results page?

    Is the “404 template” (in the new page headers) enough to make a whole “404 not found” page?

    Is there a way to use page builders (like Elementor) to make headers, footers, 404 not found …?

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    1. http://www.wpbeginner.com/wp-tutorials/how-to-exclude-pages-from-wordpress-search-results/

    2. They can build the header, but not the body. You can hide the body using CSS though.

    3. You’ll have to ask them. You can build templates and display them instead of the header, footer etc.. using GP Hooks.

    Hope this helps 🙂

    And how to exclude a hook from appearing on search page or 404 not found page? you already gave me this code:

    add_action( ‘generate_after_content’, ‘lh_add_related_post’ );
    function lh_add_related_post() {
    if ( ! is_page( array( 10, 5, primary, content ) ) ) {
    echo do_shortcode( ‘your shortcode here’ );
    }
    }

    But I don’t know the id of search page and 404 not found page.

    Thank you for your reply.

    1- I already tried this code but doesn’t work.

    2- Okay, thank you.

    3- Thank you, we need more control on hooks: the ability to disable some hooks on posts or on pages or on a specific post/page.

    Finally the code worked, my bad, thank you Tom.

    Theme Author Tom

    (@edge22)

    No problem! 🙂

    As for the code, try this:

    add_action( 'generate_after_content', 'lh_add_related_post' );
    function lh_add_related_post() {
        if ( is_singular() && ! is_page( array( 10, 5, 'primary', 'content' ) ) ) {
            echo do_shortcode( 'your shortcode here' );
        }
    }

    Wow thank you very much Thomas, this worked perfectly better than the one before.

    I just bought the premium plugin today, waiting for your great and exciting future features, good luck.

    Peace.

    Theme Author Tom

    (@edge22)

    Thank you! Glad I could help 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search results, 404 page’ is closed to new replies.