wordpress shortCode API
wordpress2.5 added a new code of Jane (shortCode) API, is a simple set of functions for the creation of content published in the macro code. Jane in the form of code as follows: [play] or [codebox ]...[/ codebox]
With Jane code API, support for the creation of the following key attributes of Jane becomes easy. Jane API code to deal with all forms of analytical work, Jane is no longer required for each code corresponding to prepare regular expressions. Helper functions are also included into the API for access to the default settings and attributes. The self-closing and the closure of the passive Jane code, API will provide support.
Overview
Jane is the code used to provide the handler. Jane processor code on a large program similar to the wordpress filters filter: They have to accept parameters (Attributes) and return the results (Jane output code). Function add_shortcode () for the registration of processor yd Jane. It has two parameters: A code name (for the article itself string) and the function of the processor. Jane processor code functions should be 1-2 parameters: $ atts (an array of properties) and $ content (which content) (if Jane contains the code for the form).
For example: function my_shortcode_handler ($ atts, $ content = null) () for the registration of processor yd Jane API call,
In the form are as follows: add_shortcode ( 'my-shortcode', 'my_shortcode_handler');
When the show the_content, Jane API code would resolve all of Jane's code, such as "[my-shortcode]", if there is property and content, will be separated from them and resolve them, and then passed to the processor code Jane Function. Any return String by the processor would be inserted into the article itself, to replace Jane code. Jane code attributes are as follows: [my-shortcode foo = "bar" baz = "bing"] code content ........[/ my-shortcode] they will be linked into an array (see below), as a $ atts Parameters passed to the function processor; $ content as the content delivery.
array ( 'foo' => 'bar', 'baz' => 'bing') is associated with an array of key attributes, while the corresponding value is the value of the property.











































