PMC Plugins
Pmc Sticky Sidebar

PMC Sticky Sidebar v1.0

Description

This plugin creates a sidebar named "Sticky Sidebar" (sticky-sidebar-rail) that can be added to single pages. This sidebar will be stick to page when scrolling to bottom. Usually this sidebar holds a 300x250 pmc-ad unit.

How does it work?

Theme config file

Filters::
  • pmc_sticky_sidebar_js_config:: Filter to override footer selector for sticky sidebar functionality.

    apply_filters( 'pmc_sticky_sidebar_js_config', [ 'footer_selector' => 'footer' ] );

Example::

add_filter( 'pmc_sticky_sidebar_js_config', 'override_sticky_sidebar_js_config' );

function override_sticky_sidebar_js_config ( $config = [] ): array {

    return [ 'footer_selector' => 'div.pmc-footer-section' ];
}

Adding widgets to Sticky Sidebar

You can add widgets from widgets page from admin side. Name of sidebar will be Sticky Sidebar (sticky-sidebar-rail).

Rendering the sticky sidebar to single page

To render sidebar on single page just add the following line.

\PMC\Sticky_Sidebar\Sticky_Sidebar::render_sticky_sidebar();

Updating JS assets

To re-minify the JS assets, run the following command in your terminal at the root of this plugin:

 uglifyjs -c -m -o assets/js/sticky-sidebar.min.js -- assets/js/sticky-sidebar.js