I'm trying to explore Wordpress and creating plug ins. I've come across a current wordpress plugin make use of a technique where one can give a 'reference' into it in your posts and Wordpress will parse it and change it using the plug ins own content. The example i'm mentioning to may be the NextGen gallery which utilizes the next code

[nextgen id=9]

I've attempted trying to find how this method works but looking for something you have no idea the title of is fairly difficult!

Can anybody point me towards some assets concerning how to make use of this feature of Wordpress?

Thanks ahead of time Stuart

The strategy is known as shortcodes.

function my_plugin_shortcode($atts, $content = null) {
  $atts = shortcode_atts($my_default_atts,$atts);  // $atts is now an associate array
  $my_content = 'This is some content.';
  return $my_content;

Then, for those who have a publish using the following content:

Hey, here's some content. [my-content]

You're going to get the next output once the publish is displayed:

Hey, here's some content. This really is some content.

Should you passed a shortcode like [my-content id="9" test="test"], then your $atts variable within the above function could be such as the following array declaration

$atts = array('id'=>9, 'test'=>'test');

The $content variable has only content if you use matching shortcodes around some text:

[my-content]This really is some test content.[my-content]