Shortcodes Generator

Overview

Use this tool to create custom code for Shortcodes with add_shortcode() function.

Usage

  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.
Shortcode tag in the content.
e.g. [tag]
The function used in the code.
Self-closing shortcode: [tag]
Enclosing shortcode: [tag]content[/tag]
Enable attributes such as
[tag foo="123" bar="456"].
Use "shortcode_atts_{$shortcode}" filter, to allow shortcode attributes filtering.
Set custom filter name.
Attribute name. Lowercase.
Default value.
e.g. [tag attr_name="default_value"]
Attribute name. Lowercase.
Default value.
Attribute name. Lowercase.
Default value.
Custom code to generate the output.
Should only "return" the text, never produce the output directly.
  Save Snippet
// Add Shortcode
function registration_form() {

	function vb_registration_form() { ?>
	 
	<div class="vb-registration-form">
	  <form class="form-horizontal registraion-form" role="form">
	 
	    <div class="form-group">
	      <label for="vb_name" class="sr-only">Your Name</label>
	      <input type="text" name="vb_name" id="vb_name" value="" placeholder="Your Name" class="form-control" />
	    </div>
	 
	    <div class="form-group">
	      <label for="vb_email" class="sr-only">Your Email</label>
	      <input type="email" name="vb_email" id="vb_email" value="" placeholder="Your Email" class="form-control" />
	    </div>
	 
	    <div class="form-group">
	      <label for="vb_nick" class="sr-only">Your Nickname</label>
	      <input type="text" name="vb_nick" id="vb_nick" value="" placeholder="Your Nickname" class="form-control" />
	    </div>
	 
	    <div class="form-group">
	      <label for="vb_username" class="sr-only">Choose Username</label>
	      <input type="text" name="vb_username" id="vb_username" value="" placeholder="Choose Username" class="form-control" />
	      <span class="help-block">Please use only a-z,A-Z,0-9,dash and underscores, minimum 5 characters</span>
	    </div>
	 
	    <div class="form-group">
	      <label for="vb_pass" class="sr-only">Choose Password</label>
	      <input type="password" name="vb_pass" id="vb_pass" value="" placeholder="Choose Password" class="form-control" />
	      <span class="help-block">Minimum 8 characters</span>
	    </div>
	 
	    <?php wp_nonce_field('vb_new_user','vb_new_user_nonce', true, true ); ?>
	 
	    <input type="submit" class="btn btn-primary" id="btn-new-user" value="Register" />
	  </form>
	 
	    <div class="indicator">Please wait...</div>
	    <div class="alert result-message"></div>
	</div>
	 
	<?php
	}

}
add_shortcode( 'registration-form', 'registration_form' );