Shortcode Mastery
Wordpress Shortcodes Builder
- created: 07/01/2017
- latest update: 08/30/2017
- by: Uncleserj
- email: support@serj.pro
Thank you for purchasing my plugin. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!
To setup Shortcode Mastery plugin just upload shortcode-mastery folder to your plugins folder and active Shortcode Mastery in plugins menu page.
Shortcode Mastery plugin allows to create unlimited numbers of shortcodes.
To create a new one just click Create Shortcode menu item and enter your shortcode name. Name can contain both upper and lower characters, numbers and spaces.
Optional you can add description and set icon.
After creating a new shortcode it can be allowed with sm_
prefix.
After that you can customize your brand new shortcode with some sections. There are 6 section that help you to create everything you need:
- Parameters
- Query
- Loop
- Markup
- Scripts
- Styles
With Parameters section you can create, edit and delete unlimited number of default parameters for your brand new shortcode.
All of your parameters are available with {[ your_parameter_name ]}
in Query, Loop, Markup, Scripts and Styles sections.
To create a new parameter just enter Parameter Name and Default Value of parameter and click the Add new parameter button.
To edit a parameter click the pencil icon after parameter's name:value couple.
To delete a parameter click the delete icon after parameter's name:value couple.
You can use text, {[ function()... ]} or php global objects in value field.
In version 1.2 added parameters types and required parameters. Important! Shortcode renders only if all required parameters are filled.
In Query section you can create unlimited number and variations of query arguments for you Loop section.
There are a lot of predefined template buttons for unlimited query variations:
- Author (Show posts associated with certain author)
- Author (id or comma-separated list of IDs)
- Author Name ('user_nicename' - NOT name)
- Author IN (array of author ids)
- Author NOT IN (array of author ids)
- Category (Show posts associated with certain categories)
- Cat (category id)
- Category Name (category slug)
- Category AND (array of category ids)
- Category IN (array of category ids)
- Category NOT IN (array of category ids)
- Tag (Show posts associated with certain tags)
- Tag (tag slug)
- Tag ID (tag id)
- Tag AND (array of tag ids)
- Tag IN (array of tag ids)
- Tag NOT IN (array of tag ids)
- Tag Slug AND (array of tag slugs)
- Tag Slug IN (array of tag slugs)
- Taxonomy (Show posts associated with certain taxonomy)
- Tax Query (taxonomy parameters)
- Post and Page (Display content based on post and page parameters)
- P (post id, default post type is post)
- Post Name (post slug)
- Post Title (post title)
- Page ID (page id)
- Page Name (page slug)
- Post Parent (page id to return only child pages, set to 0 to return only top-level entries)
- Post Parent IN (array of post ids)
- Post Parent NOT IN (array of post ids)
- Post IN (array of post ids)
- Post NOT IN (array of post ids)
- Post Name IN (array of post slugs)
- Type (Show posts associated with certain type)
- Status (Show posts associated with certain status)
- Post Status (post status)
- Pagination (Pagination parameters of posts)
- No Paging (show all posts or use pagination)
- Posts Per Page (number of post to show per page)
- Posts Offset (number of post to displace or pass over)
- Paged (number of page)
- Page (number of page for a static front page)
- Ignore Sticky Posts (ignore post stickiness)
- Order (Sort retrieved posts)
- Post Order (designates the ascending or descending order of the 'orderby' parameter)
- Posts Order By (sort retrieved posts by parameter)
- Date (Show posts associated with a certain time and date period)
- Year (4-digit year)
- Month (month number, from 1 to 12)
- Week Of The Year (week of the year, from 0 to 53)
- Day (day of the month, from 1 to 31)
- Hour (hour, from 0 to 23)
- Minute (minute, from 0 to 60)
- Second (second, 0 to 60)
- Year And Month (year and month, For e.g.: 201307)
- Date Query (date parameters)
- Meta (Show posts associated with a certain custom field)
- Meta Key (custom field key)
- Meta Value (custom field value)
- Meta Value Num (custom field number value)
- Meta Compare (operator to test the 'meta_value')
- Meta Query (custom field parameters)
You need only 3 steps to create new query argument:
- Choose query group. All query groups reflect Wordpress WP_Query object parameters.
- Choose query parameter. Choose current WP_Query object parameter.
- Enter values. Enter a value of new parameter and click the Add new value button. The current group and parameter name appear above input.
If you want to create array of values, use comma separated values in input.
After adding a new query arguments all changes are displayed in Query arguments list.
For Tax Query, Date Query and Meta Query provided special GUI.
You can add, edit, delete, group and ungroup nodes from array of elements you build. You can change relationship between nodes too.
Number before values in node shows depth of array.
If you want to move nodes on a deeper level just select some nodes (grater then 2) by checking boxes and click the Group with nesting button. To move a node on upper level click the rewind icon.
If you want to edit or delete node, use related icons.
You can change values of node parameters by clicking arrows icon.
To edit a query argument just click the pencil icon after argument's name:value couple in Query arguments list and than click the pencil icon in value item below input.
To delete a query argument click the delete icon after argument's name:value.
All array values are collapsed so to show values just click the eye icon.
You can use parameters in query arguments values. All words like true or false are converted in Boolean values regardless of parameter type.
In Loop section your code runs inside your query loop created in Query section.
Loop section uses Twig 1.x template engine and {[ tag_variable ]}
Tag Variables Syntax. All Wordpress and PHP functions are available with that syntax.
There are some predefined variables in Loop section:
-
Parameters: Reflects your shortcode parameters in Parameters section.
-
Loop Post: The Post object and its methods
-
ID: Current post ID (int).
-
Title: Current poost title (string).
-
Name: Current post slug (string).
-
Type: Current post type (string).
-
Status: Current post status (string).
-
Parent: Current post parent title (string).
-
Children: Current post children titles (array).
-
Date: Current post date created (string).
-
Time: Current post time created (string).
-
Modified: Current post date and time modified (string).
-
Permalink: Current post link (string).
-
Content: Current post contant (string).
-
Excerpt: Current post excerpt (string).
-
Meta Field: Current post custom field (type field name) (array).
-
Loop Post Thumbnail: Thumbnail data of the Post object.
-
Thumbnail Source: Current post thumbnail source (string).
-
Thumbnail Alt: Current post thumbnail alt (string).
-
Thumbnail Width: Current post thembnail width (int).
-
Thumbnail Height: Current post thembnail height (int).
-
Loop Post Author: Author data of post.
-
Author Name: Current post author display name (string).
-
Author Nicename: Current post author nicename (string).
-
Author Email: Current post author email (string).
-
Loop Post Terms: Different terms of post.
-
Terms: Current post term titles of custom taxonomy (type all, any or custom slug) (array).
-
Categories: Current post category titles (array).
-
Tags: Current post tag titles (array).
-
Loop Counts: Count variables of loop.
-
Loop All: Count of posts queried (int).
-
Loop Current: Current post index (starts from 1) (int).
-
Loop First: Is current post first (true or false) (Bool).
-
Loop Last: Is current post last (true or false) (Bool).
-
Shortcode Content: Shortcode content. Example: [sm_test]Your Shortcode Content from here![/sm_test]
See Twig 1.x documentation to learn more about template engine usage.
Markup section is a body of your brand new shortcode.
Markup section uses Twig 1.x template engine and {[ tag_variable ]}
Tag Variables Syntax. All Wordpress and PHP functions are available with that syntax.
There are some predefined variables in Markup section:
-
Parameters: Reflects your shortcode parameters in Parameters section.
-
Current Post: The Post object from current context and its methods.
-
ID: Current post ID (int).
-
Title: Current poost title (string).
-
Name: Current post slug (string).
-
Type: Current post type (string).
-
Status: Current post status (string).
-
Parent: Current post parent title (string).
-
Children: Current post children titles (array).
-
Date: Current post date created (string).
-
Time: Current post time created (string).
-
Modified: Current post date and time modified (string).
-
Permalink: Current post link (string).
-
Content: Current post contant (string).
-
Excerpt: Current post excerpt (string).
-
Meta Field: Current post custom field (type field name) (array).
-
Current Post Thumbnail: Thumbnail data of the Post object from current context.
-
Thumbnail Source: Current post thumbnail source (string).
-
Thumbnail Alt: Current post thumbnail alt (string).
-
Thumbnail Width: Current post thembnail width (int).
-
Thumbnail Height: Current post thembnail height (int).
-
Current Post Author: Author data of post from current context.
-
Author Name: Current post author display name (string).
-
Author Nicename: Current post author nicename (string).
-
Author Email: Current post author email (string).
-
Current Post Terms: Different terms of post from current context.
-
Terms: Current post term titles of custom taxonomy (type all, any or custom slug) (array).
-
Categories: Current post category titles (array).
-
Tags: Current post tag titles (array).
-
Your Custom Loop: Loop content created in Loop section
-
Shortcode Content: Shortcode content. Example: [sm_test]Your Shortcode Content from here![/sm_test]
To insert Loop section code use the LOOP button or {@ LOOP @}.
To insert your shortcode content use the CONTENT button or {@ CONTENT @}
.
In Scripts section you can add some javascript to your brand new shortcode that will be loaded in a right way in Header or Footer.
You can embed script from url and add inline scripts.
You can use parameters defined in Parameters section.
In Styles section you can add some css to your brand new shortcode that will be loaded in a right way in header.
You can use parameters defined in Parameters section.
You can embed styles from url and add inline styles.
After all changes in all sections click Save Shortcode.
You can list, edit, delete and export your shortcodes at All Shortcodes page (All Shortcodes menu item) by clicking on the corresponding buttons.
To import your shortcode text file (which was exported) use Import Shortcode section below your list of shortcodes.
To export all shortcodes use Export All Shortcodes button.
To insert your shortcode into the post or page content use Insert Shortcode button in TinyMCE Editor.
After clicking on the button you will be able to customize your shortcode or just quick insert it.
The shortcodes collection is presented under Collection Menu Button.
You can find different types of shortcodes by group, tags and using search.
There are many examples of usage and the collection is constantly updated.