WordPress searching system is'nt usefull. When you search something, it searches in posts, pages. It begins many unnecassary results. But if we can allow our visitors to select a category for their searching by creating a custom search form has a category dropdown list, i think it will be more usefull.
To do this, add theese codes in where you want to show your search form:
- <?php
- $search_form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" >
- <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
- <input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
- <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
- <br />'.
- wp_dropdown_categories('show_option_all='.__('All Categories').'&hierarchical=1&echo=0')
- .
- '</div>
- </form>';
- echo $search_form;
- ?>
Of course, you can customize the form using CSS as you want.
See at top of my sidebar. You can it (Notice: 'All Categories' means 'Tüm Kategoriler' and 'Search' means 'Ara' in Turkish).
I am sorry, i have a poor English.
Bu yazının kısa bağlantısı http://www.yakupgovler.com/?p=971.
Yazılarımı RSS aboneliği ile takip edebilir, yeni yazılarıma kolaylıkla ulaşabilirsiniz. Bunun için ise RSS adresimi kullanabilirsiniz.
Son Yorumlar