Title: Search post by category in wordpress
Tags: php;wordpress;search;blogs
Question: I have a sidebar with all the categories created like this in functions.php
// Widgets Setup
function init_widgets($id) {
register_sidebar(array(
'name'  =&gt; 'Sidebar',
'id'    =&gt; 'sidebar',
'before_widget' =&gt; '<div&gt;',
'after_widget'  =&gt; '</div&gt;',
'before_title'  =&gt; '<h3&gt;',
'after_title'   =&gt; '</h3&gt;'
));
add_action('widgets_init', 'init_widgets');
This is used to display all the categories from wordpress.
When I click a category I need to open a search box and search within that specific category.
Thank you in advance.
Comment: Yes, that's why I am asking because I don't know who to proceed further.

Comment: Yes, I am calling the sidebar inside the template, but I need to be able to click the category and open a search box and search in each category.

Comment: This is a code which initialize sidebar widgets. The code doesn't do what you are saying.

Comment: The easiest way would be to insert the php code responsible for your functionality inside the templat.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 4, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:11/16/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<php><wordpress><search><blogs>', 'Title': 'Search post by category in wordpress', 'ViewCount': 378, 'id': 40640909, 'user_AboutMe': '', 'user_AccountId': 5028874.0, 'user_DisplayName': 'Light_Warrior', 'user_Reputation': 183.0, 'user_Views': 87.0, 'user_id': 4039763.0}}