WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Meta Functions Shortcode

The “Meta Functions Shortcode” Plugin installs the Shortcode ‘meta’. With it you can access the custom fields of your articles by a shortcode.

Extending the Shortcode

Method 1: Hardcoded

You can extend the plugin by adding the PHP function

function meta_functions_shortcode_{func}($meta, $alt="") {
       return "your desired text or generated html content";
}

by writing your own plugin file with the function in it. Be sure to replace {func} with your desired function name (will result in the parameter “func” in the shortcode). $meta will be the value of the custom field and $alt the “alt” parameter.

The function should return the text by which the shortcode will be replaced. For example the “_plain” function simply returns $meta or $alt if $meta is empty.

Method 2: In the admin panel

This method is more convenient. You can add new functions in the admin panel. For this go to the options page called "Meta Functions Shortcode". Here you can enter a new function name, specify parameter names and set the output html code with the parameters.

Example:

  • Function Name: link
  • Function Parameter Names: link_url, link_caption
  • Function Result Code: <a href='{link_url}'>{link_caption}</a>

If you now enter the shortcode [meta func="link" link_url="download_url" link_caption="download_caption"] then in the article/page it will be replaced by <a href='contents of custom field download_url'><i>contents of custom field download_caption</i></a>.

Requires: 2.7 or higher
Compatible up to: 2.7.1
Last Updated: 2009-6-4
Downloads: 860

Ratings

0 stars
0 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.