Git Product home page Git Product logo

customizer-info-control's Introduction

PattonWebz Customizer Info Control

A simple control for using when you want to output a small informational section within the customizer.

Using the class

The control works just like any other custom class control in that you register a setting for it and the control and place it inside a section.

The class looks at 2 specific keys that you pass into the args array when registering the control. The title key and the html key.

The passed in value for title is wrapped inside an <h1> tag and the html is wrapped inside of a <p> tag at output time.

// The control must go in a defined section.
$wp_customize->add_section(
	'a_section',
	array(
		'title' => __( 'A Section', 'pattonwebz' ),
	)
);

// It should also have a setting defined with a custom setting 'type'.
// This can be any unique string you want - you won't be attaching custom actions to it.
$wp_customize->add_setting(
	'an_info_control',
	array(
		'type' => 'display_only',
	)
);

// Add the control with it's title and html content.
$wp_customize->add_control(
	new \PattonWebz\Customizer\Control\InfoControl(
		$wp_customize,
		'an_info_control',
		array(
			'section' => 'a_section',
			'title'   => __( 'Custom Info Control', 'pattonwebz' ),
			'html'    => __( 'This control has ability to output a title and custom html content.', 'pattonwebz' ),
		)
	)
);

You can optionally override the wrappers added by passing in an 'override_wrapper' => 'true' argument. This will output just raw html so you need to include your own wrappers and any title you may want directly in the html string.

Licence Information

This package is licensed under GNU GPLv2 or later licence.

Copyright 2019 © William Patton.

customizer-info-control's People

Contributors

pattonwebz avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.