Agreable Promo Plugin
Promotions plugin for Croissant powered WordPress sites
by Shortlist Media · github.com/shortlist-digital/agreable-promo-plugin · website
★ 0stars
2.8kcomposer installs
1forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/shortlist-digital/agreable-promo-plugin/archive/refs/heads/master.zipAlso on Packagist as shortlist-digital/agreable-promo-plugin:
composer require shortlist-digital/agreable-promo-pluginFrom the readme
Shortlist Media Wordpress Promo Plugin
Wordpress Plugin built for Croissant stack using Herbert plugin framework.
Dependencies
Timber
Advanced Custom Fields
Create custom post type
/app/customPostType.php
Plugin degines an widget using ACF available to articles
/widget-loader-acf.php
A Croissant theme (e.g. Troisieme) will traverse plugins directory for 'slm' prefixed sub directories which contain widget-loader-acf.php at their root. This ACF definition is added to list of widgets available in theme.
Add plugin view path to Timber's paths for rendering
/app/hooks/timberloaderpaths.php
Parent theme will include the plugin Twig templates and render using Timber (see lab-troisieme-2015/src/views/partials/widget-container.twig). Therefore we add our plugin paths to Timber's internal array of paths using this filter called by Timber: 'timber/loader/paths.
Fire plugin specific action whilst rendering (to enqueue styles/scripts within plugin)
/app/hooks/slmpluginenqueue.php
Just before rendering the plugin template, the parent theme calls Wordpress doaction('acf{{name}}enqueue'). e.g. (using Timber):
{% do action('slm'~widget.acffclayout~'enqueue', widget)