Filter widget by category
-
I want to have multiple widgets in my sidebar and each one pulling a specific event category. Is this possible? Right now I can only get it to display events from all categories.
-
I’m looking for this as well
First make a backup copy of widget.php.
Then edit widget.php as follows:
1. Find:
'details_length' => array( 'type' => 'text',
'std_value' => '0',
'caption' => __( 'Truncate details to' ),
'caption_after' => __( 'characters' ),
'tooltip' => __( 'If the event details are diplayed this option specifies the number of diplayed characters. Set this value to 0 to view the full details.' ),
'form_style' => 'margin:0 0 0.6em 0.9em',
'form_width' => 30 ),
Should be found at line 81.2. After, add:
'cat_filter' => array( 'type' => 'text',
'std_value' => 'none',
'caption' => __( 'Category Filter:' ),
'caption_after' => null,
'tooltip' => __( 'This attribute specifies events of which categories are shown. The standard is "none" to show all events. Specify a category slug or a list of category slugs separated by a comma.' ),
'form_style' => 'margin:0 0 0.4em 0',
'form_width' => null ),
3. Find:
$shortcode .= ' details_length='.$instance['details_length'];
Should now be found at line 164.4. After, add:
$shortcode .= ' cat_filter='.$instance['cat_filter'];That’s it. The widget now shows an input field for category slugs.
Would be a good idea to include this in future releases of this plugin.
Thanks for the help, I will include it in the next version.
This is included in the new version 0.5.0.
The topic ‘Filter widget by category’ is closed to new replies.