Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

How to add Search Results and 404 not found title in Block Element

  • Hello,

    I have created Block – Page Hero Element for all my archives and posts using Headline which automatically adds Post and Page Title

    But that doesn’t seem to work for
    Search Results Title and
    404 Page Not Found

    For these two I observed that the title appear inside content area and the block element is not working there.

    I took the PHP snippet from https://generatepress.com/forums/topic/search-results-page-element/#post-2399165 page and then I can see atleast the searched string is visible as the title, but I wanted the entire H1 title content visible in the block element instead of content using the CSS as already applied for the title block. For example: “Search Results for: hello” should appear in title when I search for ‘hello’

    Similarly for 404 page not found I have created a Content Template so is it possible to have the title of that Content Template appear as Title instead of showing inside Content section?

    Are there any other possible scenarios where I would need similar adaptations?

  • Hi there,

    For simplicity, exclude the current Page Hero Element from displaying on Search Results and the 404 Page. Then, create a specific page hero element for the Search Results page. You can use this snippet within the same topic to achieve what your desired outcome:
    https://generatepress.com/forums/topic/search-results-page-element/#post-2401791

  • golinuxcloud

    Hello Alvind,

    I am not sure how to create a page hero element for search results and what all needs to be added. If there is any sample code which I can use then I can give it a try.

    I had checked the article you shared but none of those codes in the article provides what I was looking for.

    1. I wanted the complete search title to appear in the place of title in block element. For example: “Search Results for: hello” should appear in title when I search for ‘hello’
    2. For 404 also I want similar code which replaces title with the 404 title as it happens for any other post or page title.

    Regards
    Deepak

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.