• Hello everyone,

    I got a custom search that will search in the wp_postmeta table and sort the meta_value by alphabet.

    However, I would like to add a second search function that is a dropdown box that will search in the meta_value for an exact match and return the results. Here is the custom search code that works for the search by alphabet. How can I modify this to be a drop down box that I can search for exact results?

    <div class="search-nav">
                            Search By Category
                            <ul>
                                <li><a href="<?php echo home_url() .'/search-shippers'; ?>">Reset</a></li>
                                <?php
                                    $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
                                    for($i = 0; $i < strlen($str); $i++):
                                        $class = '';
                                        if ($str[$i] == $sel)
                                            $class = ' class="actv"';
                                ?>
                                <li<?php echo $class; ?>><a href="<?php echo home_url() .'/search-shippers?sel=' . $str[$i] . '"'; ?>><?php echo $str[$i]; ?></a></li>
                                <?php
                                    endfor;
                                ?>
                            </ul>
                            <div class="clearfloat"></div>
                        </div>

    Any help would be greatly appreciated 🙂

The topic ‘Modifying Custom Search Options’ is closed to new replies.