2017 © Pedro Peláez
 

library wp-customizer-framework

A library for WordPress Customizer.

image

inc2734/wp-customizer-framework

A library for WordPress Customizer.

  • Friday, July 27, 2018
  • by inc2734
  • Repository
  • 2 Watchers
  • 8 Stars
  • 1,613 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 34 Versions
  • 27 % Grown

The README.md

WP Customizer Framework

CI Latest Stable Version License, (*1)

A Framework of WordPress Customizer API., (*2)

Install

In your theme directory., (*3)

$ composer require inc2734/wp-customizer-framework

How to use

Initialize

require_once( get_theme_file_path( '/vendor/autoload.php' ) );

new \Inc2734\WP_Customizer_Framework\Bootstrap(
  'handle' => 'main style sheet handle',
);

Customizer

use Inc2734\WP_Customizer_Framework\Framework;

Framework::panel( 'panel-id', [
  'title' => 'panel-name',
] );

Framework::section( 'section-id', [
  'title' => 'section-name',
] );

Framework::control( 'type', 'control-id', [
  'label'   => 'Header Color',
  'default' => '#f00',
] );

$panel   = Framework::get_panel( 'panel-id' );
$section = Framework::get_section( 'section-id' );
$control = Framework::get_control( 'control-id' );

$control->join( $section )->join( $panel );
$control->partial( [
    'selector' => '.blogname',
] );

Set styles

use Inc2734\WP_Customizer_Framework\Style;

add_action(
  'inc2734_wp_customizer_framework_load_styles',
  function() {
    $accent_color = get_theme_mod( 'accent-color' );

    Style::attach(
      'The handle of enqueued style',
      [
        [
          'selectors'  => [
            '.page-title',
            '.strong',
          ],
          'properties' => [
            "color: {$accent_color}",
            "border-bottom-color: {$accent_color}",
          ],
          'media_query' => '@media (min-width: 768px)', // Optional
        ],
      ]
    );
  }
);

Using placeholder

use Inc2734\WP_Customizer_Framework\Style;

add_action(
  'inc2734_wp_customizer_framework_load_styles',
  function() {
    /**
     * Extend "btn-base" placeholder
     *
     * Style::extend( 'btn-base', [ '.btn-a' ] );
     */
    include_once( get_theme_file_path( '/css/btn-a.php' ) );

    /**
     * Extend "btn-base" placeholder
     *
     * Style::extend( 'btn-base', [ '.btn-b' ] );
     */
    include_once( get_theme_file_path( '/css/btn-b.php' ) );

    /**
     * Extend "btn-base" placeholder
     *
     * Style::extend( 'btn-base', [ '.btn-c' ] );
     */
    include_once( get_theme_file_path( '/css/btn-c.php' ) );
  }
);

add_action(
  'inc2734_wp_customizer_framework_after_load_styles',
  function() {
    Style::placeholder(
      'btn-base',
      function( $selectors ) {
        $accent_color = get_theme_mod( 'accent-color' );

        Style::attach(
          'The handle of enqueued style',
          [
            [
              'selectors'  => $selectors,
              'properties' => [ "border-color: {$accent_color}" ],
            ],
          ]
        );
      }
    );
  }
);

The Versions

23/07 2018

3.1.3

3.1.3.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

23/07 2018

3.1.2

3.1.2.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

20/05 2018

3.1.1

3.1.1.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

18/05 2018

3.1.0

3.1.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

09/03 2018

3.0.8

3.0.8.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

04/03 2018

3.0.7

3.0.7.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

04/03 2018

3.0.6

3.0.6.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

06/02 2018

3.0.5

3.0.5.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

05/02 2018

3.0.4

3.0.4.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

04/02 2018

3.0.3

3.0.3.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

26/01 2018

dev-develop

dev-develop

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

26/01 2018

3.0.2

3.0.2.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

26/01 2018

3.0.0

3.0.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.6

 

The Development Requires

12/12 2017

2.3.0

2.3.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

11/12 2017

2.2.2

2.2.2.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

29/11 2017

2.2.1

2.2.1.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

08/11 2017

2.2.0

2.2.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

06/10 2017

2.1.3

2.1.3.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

29/09 2017

2.1.2

2.1.2.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

11/09 2017

2.1.1

2.1.1.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

07/09 2017

2.1.0

2.1.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

29/08 2017

2.0.6

2.0.6.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

15/08 2017

2.0.5

2.0.5.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

11/08 2017

2.0.4

2.0.4.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

02/08 2017

2.0.3

2.0.3.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

31/07 2017

2.0.2

2.0.2.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

23/07 2017

2.0.1

2.0.1.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

20/07 2017

2.0.0

2.0.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

19/07 2017

1.1.0

1.1.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

16/07 2017

1.0.2

1.0.2.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

29/06 2017

1.0.1

1.0.1.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.6

 

The Development Requires

16/06 2017

1.0.0

1.0.0.0

A library for WordPress Customizer.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3

 

The Development Requires