WP Manifestindependent plugin directory
manifest / themes / page-style-inheritance

Page Style Inheritance

Style inheritance for hierarchical pages.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/happyprime/page-style-inheritance/archive/refs/heads/trunk.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

An example style is provided with the plugin, but it is meant to be filtered with styles applicable to the theme.

add_filter( 'psi_styles', 'my_psi_styles_filter' );
/**
 * Filter Page Style Inheritance styles.
 *
 * @return array A custom list of style options.
 */
function my_psi_styles_filter() {
    return [
        ''        => [
            'name' => __( 'Inherit parent style', 'my-plugin' ),
        ],
        'my-style-one' => [
            'name'      => __( 'My Style One', 'my-plugin' ),
            'variables' => [
                '--page-style-color' => '#132324',
            ],
            'selectors' => [
                '.example-selector' => [
                    'color'            => 'var(--wp--preset--color--primary)',
                    'background-color' => 'var(--wp--preset--color--secondary)',
                ],
            ],
        ],
        'my-style-two' => [
            'name'      => __( 'My Style Two', 'my-plugin' ),
            'variables' => [
                '--page-style-color' => '#432123',
            ],
            'selectors' => [
                '.example-selector' => [
                    'color'            => 'var(--wp--preset--color--secondary)',
                    'background-color' => 'var(--wp--preset--color--primary)',
                ],
            ],
        ],
    ];
}