I have next code for search using words and category. But, i want add another condition with custom field.

how to do?

I have custom fields with name “State” and value “State1″, “State2″ and “State3″.
I want when i select obtion State 1, to show all article with custom field State - State1.

<select>
<option value="">all state</option>
<option value="....">State 1</option>
<option value="...">State 2</option>
<option value="...">State 3</option>
</select>

.

<form method="get" action="<?php bloginfo('url'); ?>">
    <fieldset>
    <input type="text" name="s" placeholder="search…"/>
    <select name="category_name" class="select">
    <option value="">toate categoriile</option>
    <?php
    $categories = get_categories();
    foreach ($categories as $category) {
        echo '<option value="', $category->slug, '">', $category->name, "</option>n";
    }
    ?>
    </select>
    <button type="submit" class="buton">Search</button>
    </fieldset>
    </form>

Read more here: Advance search with custom field wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: