How to customize search results in Twenty Twenty Two theme

  • Unknown's avatar

    I’ve switched to the Twenty Twenty Two theme and discovered when there are no search results, the page comes up blank.

    Which isn’t helpful.

    I’d like to add text like “Sorry, there were no results for your search.” or something similar when there are no search results.

    I’m not finding any option to do that in the template editor.

    Is there a way to add conditional logic to display results when there are matching terms or display “Sorry there were not results for your search” when there are no matching terms?

    The blog I need help with is: (visible only to logged in users)

  • Hello there,

    It’s possible to add this text to this template here:

    https://uxdeborah.wordpress.com/wp-admin/site-editor.php?postType=wp_template&postId=pub%2Ftwentytwentytwo%2F%2Fsearch

    If scroll to the bottom, you should see a field titled: **Add text or blocks that will display when the query returns no results.**

    I hope this helps.

  • Unknown's avatar

    Thank you, aleone89! That does solve the issue. Appreciate your help.

    Is that info available on WordPress.com support pages and I missed it?

  • Hi there, this would be roughly covered under https://wordpress.com/support/templates/#how-to-edit-templates but of course without the specifics.

    Please let us know if you have any more questions!

  • Unknown's avatar

    Thank you, staff-blorbo.

    Thank you for the link to the help on editing templates. Appreciate it.

    Not sure if I should start another request or add to this??

    I noticed the walk through of editing templates doesn’t mention Replace. Yesterday, only by chance, I used List View to display structure.

    I chose Header > Replace Header to change to a different header option in Twenty Twenty Two theme (and other full site editor themes).

    The Table of Contents highlights editing template block and adding a custom menu or footer, but nothing about replacing.

    It took me a fair amount of time to discover I needed to use Replace to change to a different header option.

    Including details on Replace in the Table of Contents would be helpful for full site editor themes that offer multiple footers or headers.

  • Replacing is more block-specific, so it’s covered in block-specific processes, like https://wordpress.com/support/wordpress-editor/page-layouts/#edit-a-page-layout and https://wordpress.com/support/wordpress-editor/block-pattern/#using-a-block-pattern

    Please let us know if you have any more questions!

  • Unknown's avatar

    Thank you for your quick response.

    In the case of Twenty Twenty Two theme, it’s not a block or block pattern that’s being replaced. It’s a template part.

  • Thanks for confirming. It sounds like you are referring to a different replace function within the new Site Editor and I’m not exactly sure where you are seeing that. Can you clarify that this is the option you are referring to?

    Click to view image

    I did a bit of digging on this and it seems that this is a known bug that is being investigated by the .org team, but since we derive the editor from the open source project it’s an issue here as well.

    I don’t have a timeline on when it will be fixed but we’re happy to update you once we have more info. Thanks for your patience!

  • Unknown's avatar

    Yes, that’s the option I’m referring to. That was the only way for me to change the headers in Twenty Twenty-Two theme.

    I wasn’t reporting an issue with it not working. I was asking if the info about using it could be added to the Table of Contents.

    Or provide some details on how to swap out/replace headers in full site editing themes that offer multiple headers and footers.

    It’s definitely clear what the options are. I knew I could replace individual blocks, but I was interested in replacing the header.

    Given there’s a bug with Replace Header, do you have a workaround on how to switch to one of the other headers in the Twenty Twenty-Two theme?

  • Hi there, at the moment, we don’t have a fix for that, but once the bug is cleared up, it should work as expected, and we’ll update the documentation.

  • The topic ‘How to customize search results in Twenty Twenty Two theme’ is closed to new replies.