Skip to content

PHP API

Jory Hogeveen edited this page Jun 7, 2018 · 9 revisions

Functions

the_ocs_off_canvas_sidebar();

@since  0.3
@param  string|array|bool  $sidebars  (Optional) The ID of this sidebar as configured in: Appearances > Off-Canvas Sidebars > Sidebars

This will echo the sidebar with all content and necessary attributes. Though the plugin frontend feature does this normally (enabled by default), you can also do this yourself.

  1. If you pass no variables it will echo all available off-canvas sidebars.
    Example: the_ocs_off_canvas_sidebar();

  2. If you pass a string, it will look for the off-canvas sidebar with the same ID and echo that sidebar.
    Example: the_ocs_off_canvas_sidebar( 'left' );

  3. If you pass an array of strings it will echo each off-canvas sidebar that matches with one of the passed strings.
    Example: the_ocs_off_canvas_sidebar( array( 'left', 'right', 'top' ) );

Your sidebar ID's can be found at Appearances > Off-Canvas Sidebars > Sidebars


the_ocs_control_trigger();

@since  0.4
@since  0.5  Add icon options.
@param  array   $atts {
    Required array of arguments
    @type  string        $id               (Required) The off-canvas sidebar ID.
    @type  string        $text             The text to show. Default: ''.
    @type  string        $action           The trigger action. Default: `toggle`.
    @type  string        $element          The HTML element. Default: `button`.
    @type  array|string  $class            Add extra classes? Also accepts a string with classes separated with a space.
    @type  string        $icon             Icon classes.
    @type  string        $icon_location    The icon location (`before` or `after`). Default: `before`.
    @type  array         $attr  {
         Other attributes to add. Format: attribute name (array key) => attribute value
    }
}
@param  string  $content  (Optional) $content
@return string

Output a trigger element for off-canvas sidebars

Example: the_ocs_off_canvas_sidebar( array( 'id' => 'left', 'text' => 'Click me!' ) );

Your sidebar ID's can be found at Appearances > Off-Canvas Sidebars > Sidebars