Skip to content
Jory Hogeveen edited this page Jul 5, 2018 · 3 revisions

Welcome to the View Admin As wiki!

Last updated for version 1.2

Documentation

You can use these filters inside your theme functions.php file or in a plugin.


Filter: widget_subtitles_element

Allows you to change the HTML element for the subtitle.
Since: 1.0
Default: span

@since  1.0.0
@since  1.1.0  Add extra parameters.
@since  1.1.3  Add WP_Widget instance parameter.

@param  string      'span'       The HTML element.
@param  string      $widget_id   The widget ID (widget name + instance number).
@param  string      $sidebar_id  The sidebar ID where this widget is located.
@param  array       $widget      All widget data.
@param  \WP_Widget  $widget_obj  The Widget object.

@return string  A valid HTML element.

Filter: widget_subtitles_classes

Allow filter for subtitle classes to overwrite, remove or add classes.
Since: 1.0
Default: array( 'widget-subtitle', 'widgetsubtitle', 'subtitle-{LOCATION}' ); Where {LOCATION} stands for your selected location.

@since  1.0.0
@since  1.1.0  Add extra parameters.
@since  1.1.3  Add WP_Widget instance parameter.

@param  array       $subtitle_classes  The default classes.
@param  string      $widget_id         The widget ID (widget name + instance number).
@param  string      $sidebar_id        The sidebar ID where this widget is located.
@param  array       $widget            All widget data.
@param  \WP_Widget  $widget_obj        The Widget object.

@return array  An array of CSS classes.

Filter: widget_subtitles_default_location

Sets the default location for subtitles.
Since: 1.1.2
Default: after-inside

@since   1.1.2

@param   string  $subtitle_location  The subtitle location (default: 'after-inside').

@return  string  Options: 'after-inside', 'after-outside', 'before-inside', 'before-outside'.

Filter: widget_subtitles_edit_location_capability

Change the capability required to modify subtitle locations.
Since: 1.1.2
Default: edit_theme_options

@since  1.1.2

@param  string  $location_cap  The capability.

@return string

Filter: widget_subtitles_available_locations

Overwrites the available locations for a widget.
NOTE: Location keys must be strings!
Since: 1.1.3
Default: array( 'after-inside', 'after-outside', 'before-inside', 'before-outside' )

@since   1.1.3
@since   1.2.0  Allow custom location + add `$widget_id` and `$sidebar_id` parameters.

@param   string[]    $locations   The array of available locations.
@param   \WP_Widget  $widget_obj  The widget object.
@param   array       $instance    The widget instance.
@param   string      $widget_id   The widget ID (widget name + instance number).
@param   string      $sidebar_id  The sidebar ID where this widget is located.

@return  string[]  $locations  The available locations: key => label.

Filter: widget_subtitles_add_subtitle

Add subtitle at a custom location.
Since: 1.2
Default: array( 'after-inside', 'after-outside', 'before-inside', 'before-outside' )

@since   1.2.0

@param  array       $params             Widget sidebar parameters from `dynamic_sidebar_params` filter.
@param  string      $subtitle           The subtitle.
@param  string      $subtitle_location  The selected subtitle location.
@param  \WP_Widget  $widget_obj         The widget object.
@param  string      $sidebar_id         The sidebar ID where this widget is located.

@return array

Filter: widget_subtitle

Filters the widget subtitle.
Since: 1.2

@since   1.2.0

@param  string      $subtitle    The widget subtitle.
@param  array       $instance    Array of settings for the current widget.
@param  string      $widget_id   The widget ID (widget name + instance number).
@param  string      $sidebar_id  The sidebar ID where this widget is located.
@param  array       $widget      All widget data.
@param  \WP_Widget  $widget_obj  The Widget object.

@return string  The new subtitle.

Clone this wiki locally