Support » Fixing WordPress » How to make a hyperlink to a predefined search?

  • Ok Sorry for the confusing title, but basically what I’m trying to do is create a way for someone on my website to simply click a hyperlink with the anchor text “dentist” and for all the search results for the search term “Dentist” to appear.

    I’m using this on a small mobile site built in WordPress that is for a very small local directory. So since people are on a phone it’s easier to have the word “Dentist” or whatever that leads to the listing. Also we aren’t able to use “Categories” or “tags” with this particular mobile site so that ruled that out.

    Thanks for all your help!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Code below should do it.

    <a href="/?s=dentist&submit=Search">dentist</a>

    Sorry it created a link


    put the code above in an href and it will work

    weird now it is showing up haha. Anyway that should work

    Awesome jclark! That worked, but I need to figure out how to have it only pull and display results from the mobile version. The mobile version is made using custom post-types I think.

    I thought there was a way to add some code to the functions.php file, but honestly I’m NOT a programmer so not sure. Maybe you know?

    is your mobile version just css changes or are you calling content independently?

    Just CSS changes I think? I didn’t develop it and I’m not too techie so I believe that’s the case. It’s a plugin that I’m using

    For you to only be able to search what you have on your mobile site you would have to have some way of defining if the content was mobile content or not. And yes there is a way to do that. But I dont think I could explain it to you through this forum. It would take a little bit of work.

    I understand. Yeah I was thinking of using the fact that it’s a custom post type to define the content. I thought that might work I just don’t know HOW to make it work LOL

    I can get you something that will search only stuff in a custom post type if that will work?

    Yeah man that would be great. if I could use that with the code you already gave me that would probsbly work just fine

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to make a hyperlink to a predefined search?’ is closed to new replies.