Never miss a thing!

Sign up to have the latest news and announcements from my site delivered straight to your inbox.
  • This field is for validation purposes and should be left unchanged.

Reader Interactions

Comments

  1. Great resource Carrie! Thanks for the tip!

    I never noticed the MASSIVE featured image area on your blog before. I like it!

  2. Aha! Nice one. I was thinking of writing the same tutorial when I noticed Bill updated his plugin to include the shortcode for search form. But since you’ve wrote this tutorial, now I don’t have to dig the code. Feel so great being in this AWESOME #genesiswp community 🙂

  3. Been a long time Genesis user and just found your blog a few weeks ago. Thanks for all the code info and also for the humor. Already see a bunch of stuff here I wanna read here.

  4. Hey Carrie,

    I don’t know why, but it didn’t work for me until I altered line 3 to this:
    [pre]add_shortcode( ‘genesis-404-search’, array( $this, ‘search_shortcode’ ) );[/pre]

    But now that I got it working I’m going to use it on my new theme.

    Not sure if when I hit submit the code will get mangled or not….

    -rd

  5. Hmmm. It doesn’t work for me.

    I had the get the plugin, as no matter what I tried I couldn’t get the functions.php code to work.

    (on the Agency Pro them, by the way)

  6. Hello,

    You can also try this trick.

    <form method="get" id="searchform" action="/”>

    <input type="text" value="” name=”s” id=”s” />

    Select a Category
    <?php
    $allcategories= get_categories();
    foreach ($allcategories as $c) {
    $option = 'cat_ID.'”‘;
    $option .= ‘>’;
    $option .= $c->name;
    $option .= ”;
    echo $option;
    }
    ?>

  7. Thank you! That was very helpful! I had to fiddle with the css to get the style right for in-page placement, but easy peasy!

    • I’ve been using this great snippet of code for a while, and wondering if there’s an easy way to add a “Search again?” link to the search results, since my client’s site doesn’t have a sidebar, and it would be super handy to have a link like that either above or below the search result… Any thoughts? Thanks in advance! 🙂

      • Heya! What theme are you using? The general concept (I think from what you said) is to place another search box above the search results in order to search again. You’d need to “hook” an area with the search form above the page with the search results.

        • Hi Carrie: We’re using a highly modified Genesis/Lifestyle Pro Theme… Thinking that I might use Genesis Simple Hooks (which I use a lot), I activated Genesis Visual Hook Guide > action hooks and found these hooks above and below the search result for a bogus search string:

          genesis_before_loop

          Home > Search results for ‘bogus-search-term’

          Search Results for: ‘bogus-search-term

          genesis_loop

          … So, I added a “Try another search” link (adding to your PHP code), and that works great…

          “No content matched your criteria. Try another search…”

          For the case where there is a valid search result, I just used the Genesis after_content hook … It’s a bit of scrolling to get to when there are multiple (or long) results, but I think it will work…

          THANKS! 🙂

Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *