• hi

    how do i set up a search that has multiple predetermined fields for only a category.

    would this need to search tags? like a real estate search?

    Many thanks for your time

Viewing 6 replies - 1 through 6 (of 6 total)
  • i have code that will list tags in a specific category, without duplication. It provides links to an archive view of all posts which have the tag.

    <ul><?php
    error_reporting(0);
    @ini_set(‘display_errors’, 0);
    query_posts('category_name=uncategorized');
    	if (have_posts()) : while (have_posts()) : the_post();
            $posttags = get_the_tags();
    		if ($posttags) {
    			foreach($posttags as $tag) {
    				$all_tags_arr[] = $tag->term_id; //USING JUST $tag MAKING $all_tags_arr A MULTI-DIMENSIONAL ARRAY, WHICH DOES WORK WITH array_unique
    			}}endwhile; endif; wp_reset_query();
    $tags_arr = array_unique($all_tags_arr); //REMOVES DUPLICATES
    	//echo '<pre>'.print_r($tags_arr, true).'</pre>'; //OUTPUT FINAL TAGS FROM CATEGORY
    echo '<ul>';
    foreach ($tags_arr as $tag) {
    echo '<li><a href="' . get_tag_link($tag) . '">' . get_tag($tag)->name . '</a></li>';
    }echo '</ul>';
    ?></ul>

    otherwise there’s a tag search plugin I used a while back. Returns all posts with a given tag, but I’m pretty sure not specific to categories. haven’t seen a plugin that can do that yet.

    advanced-tag-search

    Thread Starter grishart

    (@grishart)

    hi Deepbevel

    sounds good but I think it needs to be more like a search / filter for multiple criteria.

    thanks

    If you create the tags, the terms you use become the criteria. You can alternately use a tag search instead of a showing a list. Tag searches can be based on mulltiple criteria.

    I know of one plugin that does tag searches:

    advanced-tag-search

    You can mod the default form, here’s what I did with mine:

    # Default form
    $str .= '
    <form method="POST" action="" id="form-search-tags">
        <fieldset>
    
                <table>
                <tr>
     <td>
     Gift recipients first and last name
                        </td>
                        <td>
                            <input type="text" name="tagname_is" />'.$error.'
                        </td>
                        </tr>
               <td style="display:none;">
                           <select name="order_by">
                           <option value="terms.name"></value>
                           </select>
                         </td>
                         </tr>
                         <tr>
                        <td>
                            <input type="hidden" value="reset fields" />
                        </td>
                        <td>
                            <input type="submit" value="search " />
                        </td>
                    </tr>
                </table>
        </fieldset>
    <input type="hidden" name="search" value="ok" />
    </form>
    ';

    My example:
    demo

    Thread Starter grishart

    (@grishart)

    hi deepbevel

    Thanks for the link very interesting and could be just what I am after. will have a play and see what I come up with!

    thanks
    grishart

    should work perfectly for filtering searches based on multiple terms.
    good luck and let me know how it goes.

    Thread Starter grishart

    (@grishart)

    will do thanks for your help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘custom search’ is closed to new replies.