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 paypal_shortcode( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'paypal_email' => '',
			'paypal_item' => '',
			'paypal_return' => '',
		),
	);

	return '<section class="container mc centered"><br><form name="_xclick" target="_blank" class="pure-form tenp clearfix" action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="business" value="' . $paypal_email . '"><input type="hidden" name="return" value="' . $paypal_return . '"><input type="hidden" name="item_name" value="' . $paypal_item . '"><input type="hidden" name="currency_code" value="USD"><div class="columns seven blk nof mc"><div class="pure-g"><div class="pure-u-1-6"><span style="font-size:2.5em;padding:0px;line-height: .85em;" class="nm">$</span></div><div class="pure-u-1-3"><input type="text" class="fw" name="amount" value=""></div><div class="pure-u-1-3"><input type="submit" name="submit" alt="Donation securely with PayPal" title="Donation securely with PayPal" value="ONE" style="padding: .5em .6em;border: 1px solid #ccc;" class="pure-button pure-button-primary fw"></div></div></div></form><!--paypal logos--><div class="mctwn ui-sprite paypalLogo"></div><br><!--paypal logos end--></section>';

}
add_shortcode( 'paypal', 'paypal_shortcode' );