A
A
Andy-shak2015-11-19 17:48:48
WordPress
Andy-shak, 2015-11-19 17:48:48

Implementing a tag search filter in wordpress?

How can I implement a tag search filter in WordPress? (Without plugin).
So that for example I select the label "bmw" from the drop-down list and everything related to the label "bmw" is displayed.
Or tell me a ready-made solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andy-shak, 2015-11-19
@Andy-shak

Mb to whom it is useful
The form below allows the user to refine his choice of search from a specific tag:

<form method="get" action="<?php bloginfo('url'); ?>">
<fieldset>
<input type="text" name="s" value="" placeholder="search&hellip;" maxlength="50" required="required" />
<select name="tag">
<?php
// генератор списка меток
$tags = get_tags();
foreach ($tags as $tag) {
    echo '<option value="', $tag->slug, '">', $tag->name, "</option>\n";
}
?>
</select>
<button type="submit">Поиск</button>
</fieldset>
</form>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question