{"id":5372,"date":"2009-04-23T16:26:19","date_gmt":"2009-04-23T16:26:19","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/meta-functions-shortcode\/"},"modified":"2009-06-04T05:34:13","modified_gmt":"2009-06-04T05:34:13","slug":"meta-functions-shortcode","status":"closed","type":"plugin","link":"https:\/\/snd.wordpress.org\/plugins\/meta-functions-shortcode\/","author":2522575,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"3.4","stable_tag":"trunk","tested":"2.7.1","requires":"2.7","requires_php":"","requires_plugins":"","header_name":"Meta Functions Shortcode","header_author":"Matthias Amacher","header_description":"","assets_banners_color":"","last_updated":"2009-06-04 05:34:13","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/www.matthiasamacher.ch\/wordpress\/meta-functions-shortcode","header_plugin_uri":"http:\/\/wordpress.org\/extend\/plugins\/meta-functions-shortcode","header_author_uri":"http:\/\/www.matthiasamacher.ch","rating":0,"author_block_rating":0,"active_installs":10,"downloads":2318,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","2.0","3.3"],"block_files":[],"assets_screenshots":{"screenshot-1.jpg":{"filename":"screenshot-1.jpg","revision":"1566831","resolution":"1","location":"plugin","width":982,"height":312}},"screenshots":{"1":"This is a screenshot of the extionsion mechanism in the admin panel."}},"plugin_section":[],"plugin_tags":[2010,683,80],"plugin_category":[43],"plugin_contributors":[92437],"plugin_business_model":[],"class_list":["post-5372","plugin","type-plugin","status-closed","hentry","plugin_tags-custom-fields","plugin_tags-meta","plugin_tags-shortcode","plugin_category-customization","plugin_contributors-noby","plugin_committers-noby"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/meta-functions-shortcode.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/meta-functions-shortcode\/trunk\/screenshot-1.jpg?rev=1566831","caption":"This is a screenshot of the extionsion mechanism in the admin panel."}],"raw_content":"<!--section=description-->\n<p>The \u201cMeta Functions Shortcode\u201d Plugin installs the Shortcode \u2018meta\u2019. With it you can access the custom fields of your articles by a simple shortcode.<\/p>\n\n<p>Shortcode Syntax: <code>[meta func=\"\" name=\"\" alt=\"\"]<\/code><\/p>\n\n<p>The shortcode has three functions yet:<\/p>\n\n<ol>\n<li>func=\u201durl\u201d\n  Displays a link using your custom field in \u201cname\u201d as the link target and \u201calt\u201d as the caption. If \u201calt\u201d is empty the link target is used as the caption.<\/li>\n<li>func=\u201dplain\u201d\n  Simply displays the custom field in \u201cname\u201d as plain text. If the field is empty it displays the text in \u201calt\u201d.<\/li>\n<li>func=\u201dimg\u201d\n  Inserts the image at the url in your custom field \u201cname\u201d into the article. The \u201calt\u201d argument is used as the images alternative text attribute.<\/li>\n<li>More functions in later versions of the plugin\u2026 Or extend the plugin on your own. See Extending the Plugin (under Other Notes) for details.<\/li>\n<\/ol>\n\n<h4>Example<\/h4>\n\n<pre><code>[meta func=\"url\" name=\"download_url\" alt=\"Download here\"]\n<\/code><\/pre>\n\n<p>This little code in your article displays a link using your custom field \u201cdownload_url\u201d as the link target and \u201cDownload here\u201d as the caption. If you leave the \u201calt\u201d argument empty then it uses the link target as the caption.<\/p>\n\n<p>The resulting html code is:<\/p>\n\n<pre><code>&lt;a href='{download_url}'&gt;{alt}&lt;\/a&gt;\n<\/code><\/pre>\n\n<h3>Extending the Shortcode<\/h3>\n\n<h4>Method 1: Hardcoded<\/h4>\n\n<p>You can extend the plugin by adding the PHP function<\/p>\n\n<pre><code>function meta_functions_shortcode_{func}($meta, $alt=\"\") {\n       return \"your desired text or generated html content\";\n}\n<\/code><\/pre>\n\n<p>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 \u201cfunc\u201d in the shortcode). $meta will be the value of the custom field and $alt the \u201calt\u201d parameter.<\/p>\n\n<p>The function should return the text by which the shortcode will be replaced. For example the \u201c_plain\u201d function simply returns $meta or $alt if $meta is empty.<\/p>\n\n<h4>Method 2: In the admin panel<\/h4>\n\n<p>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\".\nHere you can enter a new function name, specify parameter names and set the output html code with the parameters.<\/p>\n\n<p>Example:<\/p>\n\n<ul>\n<li>Function Name: link<\/li>\n<li>Function Parameter Names: link_url, link_caption<\/li>\n<li>Function Result Code: <code>&lt;a href='{link_url}'&gt;{link_caption}&lt;\/a&gt;<\/code> <\/li>\n<\/ul>\n\n<p>If you now enter the shortcode [meta func=\"link\" link_url=\"download_url\" link_caption=\"download_caption\"] then in the article\/page \nit will be replaced by <code>&lt;a href='contents of custom field download_url'&gt;&lt;i&gt;contents of custom field download_caption&lt;\/i&gt;&lt;\/a&gt;<\/code>.<\/p>\n\n<!--section=installation-->\n<p>Install it like every other wordpress plugin:<\/p>\n\n<ol>\n<li>Upload the directory <code>meta-functions-shortcode<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Needed files: <code>meta-functions-shortcode.php<\/code>, <code>mfs_options_form.php<\/code>, <code>mfs_options_handler.php<\/code> and <code>mfs_scripts.js<\/code> (must be in the same directory)<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Use it in your Wordpress articles or where your shortcodes are allowed<\/li>\n<\/ol>\n\n<!--section=faq-->\n<p>If you have questions or comments on the plugin, go to <a href=\"http:\/\/www.matthiasamacher.ch\/wordpress\/meta-functions-shortcode\" title=\"Authors Blog\">www.MatthiasAmacher.ch<\/a>\n and wirte a comment on the article.<\/p>","raw_excerpt":"The \u201cMeta Functions Shortcode\u201d Plugin installs the Shortcode \u2018meta\u2019. With it you can access the custom fields of your articles by a shortcode.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/5372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=5372"}],"author":[{"embeddable":true,"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/noby"}],"wp:attachment":[{"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=5372"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=5372"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=5372"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=5372"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=5372"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/snd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=5372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}