According to Codex:
function shortcode_function_name( $atts ) {
$atts = shortcode_atts( array(
'attr1' => '',
), $atts, 'your-shortcode-name' );
return '<div id="'.$atts['attr1'].'">Your Predefined Content</div>';
}
add_shortcode( 'your-shortcode-name', 'shortcode_function_name' );
Adding [your-shortcode-name attr1="Value1"]
to the content of any post/page will give the following output <div id="Value1">Your Predefined Content</div>
.
Adding [your-shortcode-name attr1="Value1"]
to the content of any post/page will give the following output <div id="Value1">Your Predefined Content</div>
.
etc…
And you can deep by adding the predefined content inside the shortcode, this way you can always change the predefined content inside the shortcode as well.
Hope it helps!