Giter VIP home page Giter VIP logo

shortcode-popups's Introduction

WordPress shortcode popups generator.

WordPress shortcode popups generator is a PHP class, which facilitates creation of WordPress dynamic popup windows. This should help the developers out in creation of a well thught user interface for a more complex shortcodes having several fields. Generally manual management of shortcodes is quite cumbersome, our class aims to sort that issue out. (for a more visually appealing version of the readme, please see github pages)

Basic Usage

  1. First instantiate the class

$shortcodes = new WP_Doin_Shortcodes_Generator();

  1. Add a shortcode

$test = $shortcodes->add_shortcode( 'acfrpw', 'ACFRPW', 'Choose from a list of settings to create the acfrpw shortocde. Any content (shortcodes as well) can be placed in the textareas.' );

  1. Add some fields

$test->add_field( 'text', 'css', __( 'CSS Class', 'acf_rpw' ) );

  1. Generate the shortcode

$shortcodes->generate();

You'll end up with a popup window that would place the following shortcode for you:

[acfrpw css="the text you specified"]

Available fields

Currently there are 5 available fields to specify. The second argument of each add_field method needs to be different, as the values are stored as keys of the associative array. All of the fields take from 3 to 5 arguments, the first one denotes the type of the field used, the second one, a uniqe name of the field. The third one a heading of the element, which should describe the element, the fourth one a description, which describes the element in detail and the fift one, used for the select and checkbox fields is an array of key -> value pair used for the values and names of select options and checkbox fields.

  • Column field The column field is used to divide the viewport to 1/3. Each column should have a 'start' and 'end' elements, placed respectively before and after all other column fields

->add_field( 'col', 'fcs', 'start' )

  • Text field

The text field takes 3 to 4 arguments, the first one denotes the type of the field (text), the second one its unique name, the third one its heading and the foruth one an optional description.

->add_field( 'text', 'css', __( 'CSS Class', 'acf_rpw' ) )

  • Select field

The select field takes 5 arguments, the first one denotes the type of the field (select), the second one its unique name, the third one its heading, the fourth one a description (input empty string for none) and the fifth its key -> value pairs.

>add_field( 'select', 'ord', __( 'Order', 'acf_rpw' ), '', array( 'ASC' => __( 'Ascending', 'acf_rpw' ), 'DESC' => __( 'Descending', 'acf_rpw' ) ) )

See the source code for more information.

shortcode-popups's People

Contributors

gicolek avatar

Stargazers

Luke Cavanagh avatar

Watchers

 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.