Title: Calling widget using shortcode query poblem
Last modified: August 21, 2016

---

# Calling widget using shortcode query poblem

 *  [Ravi Kumar](https://wordpress.org/support/users/howtoplease/)
 * (@howtoplease)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/calling-widget-using-shortcode-query-poblem/)
 * I am calling a widget using shortcode,
    everything is wordking except when I 
   passs a widget option as a query then it only accepts title.
 * **Like **
    `[widget name="WP_Widget_Categories"]title=Category&dropdown=1&count
   =1&hierarchical=1[/widget]`
 * Now when this shortcode output then it shows my title query but no action for
   other three query. I tried this with all widget, same problem.
 * Please check if my query format is mistaken.
 * **and here is my shortcode function**
 *     ```
       add_shortcode('widget','widget');
       function ra_widget($atts, $content) {
       	// Configure defaults and extract the attributes into variables
       	extract( shortcode_atts(
       		array(
       			'name'  => ''
       		),
       		$atts
       	));
   
       	ob_start();
       	the_widget($name, $content, 'before_widget=<div class="post-widget">&after_widget=</div>&before_title=<h3>&after_title=</h3>');
       	$output = ob_get_clean();
   
       	return $output;
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/calling-widget-using-shortcode-query-poblem/#post-3940139)
 * It appears shortcode content is run through htmlentities() so that the ‘&’ parameter
   separator gets converted to `# 038;` (without the space). Thus the string parser
   of `the_widget()` fails to parse any arguments after any ‘&’ characters since
   that character is no longer found.
 * You can undo this with
    `$content = html_entity_decode($content);` in your shortcode
   callback before the call to `the_widget()`, after which all your parameters should
   be parsed correctly.

Viewing 1 replies (of 1 total)

The topic ‘Calling widget using shortcode query poblem’ is closed to new replies.

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [the_widget](https://wordpress.org/support/topic-tag/the_widget/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/calling-widget-using-shortcode-query-poblem/#post-3940139)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
