• How can I style the layout of my page depending on the search?

    Simple example: when showing the results for the search on “apple”, the sidebar has a green background and when showing the results for the search orange, the sidebar has an orange background.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You have to create two separate and unique pages, and target unique keywords for each page.

    For example: you create page about apples, and give it a green sidebar, then use apple,apples,green apples,delicious apples as your keywords.

    Then you create a page about oranges and give it an orange sidebar, then use orange,oranges,florida oranges as your keywords.

    Thread Starter Cryo

    (@cryo)

    So, I have to create two different pages depending on the search?

    page 1 – mywordpress.org/?s=apples
    page 2 – mywordpress.org/?s=oranges

    That’s the most basic way of doing it.

    You could have general page about fruit with apples and oranges on it, then display a different sidebar based on which one the user searched for.

    To do that you’d have to know which search terms they used to get to your page, then display a different sidebar based on which term they used. You’d also have to decide which sidebar to display if the user came to your page from a bookmark or typed your url into their address bar, or clicked a link on another page.

    I think you’re better off separating the two into separate posts and targeting specific keywords. You’ll prolly get higher page rank that way, you can focus on the details of the separate topics in separate posts, it’s a lot easier, besides the user won’t be able to tell which method you used anyways.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Different layout depending on search results?’ is closed to new replies.