Site logo

Archived topic

how to style the page search

9 replies · Started by Karsten on July 1, 2021

Viewing posts 1–10 of 10

Hi Friends,

I have checked the archive but could not find a suitable solution for this two issues:

How could I add a Search term to the page search?

Any suggestions how I could style the page search?

Here is the link to our page and the search bar (without search text).

Thank you very much.

Hi Karsten,

Not sure I fully understand your question.

What do you mean by adding a search term to the search page? Can you explain some more?

Or is there any example site we can be looking at?

Let me know :)

Hi Ying,

when you use the page search it is not styled yet and also there is no word like "Search" or so.

Please check this screenshot

Where the red error is I want to see the German word for Search.

Thank you for your help

No, this is not what I want. Sorry, that I have problems to express my issue.

So, I try again:

I would like to add and see the word "Search" when someone is using the page search. Currently the word "Search" is not showing when I use the page search. When someone clicks on the search icon there should also be shown "Search".

I hope now I could make it clearer.

Thank you

Do you mean the search bar input area in the navigation?
https://www.screencast.com/t/ycPycNxmGi8

If so, try this PHP snippet:

add_filter( 'generate_navigation_search_output', function() {
    printf(
        '<form method="get" class="search-form navigation-search" action="%1$s">
            <input type="search" placeholder="Search" class="search-field" value="%2$s" name="s" title="%3$s" />
        </form>',
        esc_url( home_url( '/' ) ),
        esc_attr( get_search_query() ),
        esc_attr_x( 'Search', 'label', 'generatepress' ) 
    ); 
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Hey Ying,

this PHP snippet I was looking for.

But on mobile the "Search" term does not show up. Could you please help with more PHP?

Thank you very much.

This snippet should work for both desktop and mobile.

And I tested it on my phone, it works.

Can you try again on a new incognito window on your phone?

There might be some cache on your mobile browser.

Let me know :)

Yes, it works perfectly.

Thank you for your great support.

Best

You are welcome Karsten :)

This archived topic is closed to new replies.