Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Resolved] Page Header titles in Search and Not Found

Home Forums Support [Resolved] Page Header titles in Search and Not Found

Home Forums Support Page Header titles in Search and Not Found

  • This topic has 3 replies, 2 voices, and was last updated 3 years ago by Leo.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #559387
    Iban

    I would love to use {{post_title}} for search results and not found / 404 page titles too

    Now those titles appears in the content and {{post_title}} gets empty

    I would love the same behavior as it works in archives right now

    I think the only proper way would be modifying the plugin because doing [my_own_title_shortcode] seems to break everything and confuse titles or something…

    GeneratePress 2.0.2
    GP Premium 1.6.2
    #559561
    Leo
    Staff
    Customer Support

    Hi there,

    This should work for search: https://generatepress.com/forums/topic/page-header-for-search-results/#post-403642

    As for 404, might easier to create a separate page header and just manually insert the title.

    Let me know if this helps.

    #559586
    Iban

    Great

    Done this for the new Search Header to show it in my language

    function mi_search_func() {
      return sprintf( __( 'Search Results for: %s', 'generatepress' ), '<span>' . get_search_query() . '</span>' );
    }
    add_shortcode('mi_search', 'mi_search_func');

    and then css for removing the actual title that is not removed automactly:

    .search .page-header {
        display: none;
    }

    Finishing i created a new Page Header for 404. Sounds weird having so much copies of the “same” header but offer much more flexibility in design. I think everything is ok…

    Many Thanks!

    #559708
    Leo
    Staff
    Customer Support

    Glad you’ve figured it all out!

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