Campo de busca por tags no wordpress

Geralmente campos de busca nos themas do wordpress ele por si busca por posts. No meu caso o cliente queria uma busca por TAG tive varios problemas mas a solução foi ..

Formulario padrão de busca:

<form action=”<?php bloginfo(‘home’); ?>” method=”get”> <input type=”text” name=”s” pleceholder=”buscar”> <input type=”submit” name=”bt-search” value=”Ok”> </form>

Formulario para busca de TAGS:

<form action=”<?php bloginfo(‘home’); ?>” method=”get”> <input type=”text” name=”s” pleceholder=”buscar”> <input name=”tag” type=”text” <?php if(get_search_query()) { echo ‘value=”’.trim(strip_tags(esc_attr(get_search_query()))).’”’; } else { ?> value=”<?php _e(‘Buscar no site’,’colabsthemes’); ?>” onfocus=”if (this.value == ‘<?php _e(‘Buscar no site’,’colabsthemes’); ?>’) {this.value = ‘’;}” onblur=”if (this.value == ‘’) {this.value = ‘<?php _e(‘Buscar no site’,’colabsthemes’); ?>’;}” <?php } ?>> </form>

<form action=”<?php bloginfo(‘home’); ?>” method=”get”> <input type=”text” name=”s” pleceholder=”buscar”> <input name=”tag” type=”text” <?php if(get_search_query()) { echo ‘value=”’.trim(strip_tags(esc_attr(get_search_query()))).’”’; } else { ?> value=”<?php _e(‘Buscar no site’,’colabsthemes’); ?>” onfocus=”if (this.value == ‘<?php _e(‘Buscar no site’,’colabsthemes’); ?>’) {this.value = ‘’;}” onblur=”if (this.value == ‘’) {this.value = ‘<?php _e(‘Buscar no site’,’colabsthemes’); ?>’;}” <?php } ?>> </form>

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.