John Mark Causing

System Administrator | Hosting Support Engineer

Bacolod City, Philippines

+639393497018

John Mark Causing

System Administrator | Hosting Support Engineer

Bacolod City, Philippines

+639393497018

If you are curious about how shortcodes on your site were created like if you saw something like a shortcodes that generates your form, contents and others, see the steps by on how to create basic PHP shortcodes for your WordPress site.

Step 1:

Register a shortcode function.

function register_my_shortcodes() {
	
	add_shortcode('your_string_shortcodes', 'your_function_shortcodes_content');
	
}

your_string_shortcodes is the Shortcode tag to be searched in post content like [your_string_shortcodes]

your_function_shortcodes_content is where your function that consist of the shortcodes content

Step 2:

Create a function for your shortcodes content

function your_function_shortcodes_content( $args, $content="") {
	
	// setup our output variable - the form html 
	$output = '
		<div class="your_class">
                  <h1>This is your Shortcodess Content</h1>
		</div>
	';
	
	// return our results/html
	return $output;	
}

Step 3:

Start the shortcodes after your WordPress loads. Fires after WordPress has finished loading but before any headers are sent.

add_action('init', 'register_my_shortcodes');