Search-banner: welcome text for unregistered users

AI-generated summary

In a discussion about customizing the search banner for unregistered users, ecki proposed displaying different welcome text based on login status—such as “Please register to search in all Categories” for guests versus a general welcome for logged-in users. simon suggested a CSS workaround to conditionally display text for anonymous users using the .anon class, providing code and visual examples for both logged-in and logged-out states, while cautioning to test across devices and browsers. ecki appreciated the suggestion but opted for a more neutral text for now, still advocating for an out-of-the-box solution and asking if the current post and tags are sufficient to preserve the feature idea for future consideration.

I would like to have the search banner display the subheading depending on if the user is logged in or not. This way I can easily mention that only a subset of categories are available. One option would be to have a general way to have different configs for the same component for multiple levels, the other option is to add a new text for unauthenticated users. “Please register to search in all Categories” vs. “Welcome …”.

2 Likes

Possibly you could achieve what you’re looking for with CSS. I’m not a CSS expert, but was just looking at a similar issue. Something like this added to your theme might do the trick:

.anon .custom-search-banner p:after {
    content: "Please register to search in all Categories.";
    display: block;
}

Anon users will see:

Logged in users will see:

If you use this, be sure to test on mobile devices and ideally a few different desktop browsers.

4 Likes

Thanks for the tip! I went the easy route and formulated the text more neutral. Still think it would be useful to have out of the box. Is the post here and the tags enough to keep the idea?

Closing per Deprecating the Search Banner theme component

The functionality requested in this topic is supported by the welcome banner, see Creating a banner to display at the top of your site