shortlist-digital/agreable-promo-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shortlist-digital/agreable-promo-plugin

最新稳定版本:4.0.3

Composer 安装命令:

composer require shortlist-digital/agreable-promo-plugin

包简介

Wordpress plugin for Shortlist Media.

README 文档

README

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/timber_loader_paths.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/slm_plugin_enqueue.php
    Just before rendering the plugin template, the parent theme calls Wordpress do_action('acf_{{name}}_enqueue'). e.g. (using Timber):
    {% do action('slm_'~widget.acf_fc_layout~'_enqueue', widget) %}
    The hook name is constructed from the ACF Field Group 'name' in widget-loader-acf.php. e.g. 'acf_promo_plugin_enqueue'

Configurable plugin options for Wordpress installation

  • app/panels.php
    Adds Settings panel for installation specific configuration. Uses ACF definitions.
Using ACF to create panels in Post Type menu
acf_add_options_sub_page(array(
  'page_title'  => 'Promo Style Settings',
  'menu_title'  => 'Promo Settings',
  'parent_slug' => 'edit.php?post_type=promo',
));
Add Custom Fields to menu

Specify custom fields using register_field_group($options). Best to create in Worpdress Admin and use export function. $options['location'] will be an array specifying where to display the Custom Fields:

array (
  array (
    array (
      'param' => 'options_page',
      'operator' => '==',
      'value' => 'acf-options-promo-settings',
    ),
  ),
),

Note: If acf_add_options_sub_page is given 'menu_title' of 'Promo Settings', the location 'value' is 'acf-options-promo-settings' (as above).

Deploy to packagist

Check the current latest tag git fetch && git tag

Bump the version appropriately and tag git tag x.x.x

Push to Github. Packagist will receive a hook and update the file git push origin master --tags

统计信息

  • 总下载量: 2.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 11
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-29