{"id":469,"date":"2023-10-21T06:44:45","date_gmt":"2023-10-21T06:44:45","guid":{"rendered":"https:\/\/wpshortcode.org\/?p=469"},"modified":"2023-10-21T06:44:46","modified_gmt":"2023-10-21T06:44:46","slug":"acf-extended","status":"publish","type":"post","link":"https:\/\/wpshortcode.org\/acf-extended\/","title":{"rendered":"Advanced Custom Fields Extended Shortcode"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Below, you&#8217;ll find a detailed guide on how to add the <strong>Advanced Custom Fields: Extended Shortcode<\/strong> to your WordPress website, including its <strong>parameters<\/strong>, <strong>examples<\/strong>, and <strong>PHP function code<\/strong>. Additionally, we&#8217;ll assist you with common issues that might cause the Advanced Custom Fields: Extended Plugin shortcode not to show or not to work correctly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before starting, here is an overview of the Advanced Custom Fields: Extended Plugin and the shortcodes it provides:<\/p>\n\n\n<p>    <div class=\"plugin-info-box\">\n        <div class=\"top-main\">\n            <!-- SVG Image -->\n            <div class=\"plugin-image\">\n                <img decoding=\"async\" src=\"https:\/\/ps.w.org\/acf-extended\/assets\/icon-128x128.png?rev=2071550\" alt=\"Plugin Icon\" \/>\n            <\/div>\n            \n            <div class=\"plugin-descriptive-part\">\n                <!-- Plugin Name with Link -->\n\n                    <a class=\"plugin-title\" href=\"https:\/\/wordpress.org\/plugins\/acf-extended\" target=\"_blank\" rel=\"noopener\">\n                        Advanced Custom Fields: Extended                    <\/a>\n\n\n                <!-- Plugin Description -->\n                <p class=\"plugin-description\">\n                    &quot;Advanced Custom Fields: Extended is a powerful WordPress plugin that enhances your website&#039;s custom fields. It offers advanced features like bidirectional relationships, post type selection, and more.&quot;                <\/p>\n            <\/div>\n        <\/div>\n\n        <!-- Rating and Additional Info -->\n        <div class=\"plugin-meta\">\n            <span class=\"plugin-rating\">\n                <span class='stars'>\u2605\u2605\u2605\u2605\u2606<\/span> (126)\n            <\/span>\n            <span class=\"plugin-active-installs\">\n                <strong>Active Installs<\/strong>: 80000+\n            <\/span>\n            <span class=\"plugin-tested\">\n                <strong>Tested with<\/strong>: 6.3.2            <\/span>\n            <span class=\"plugin-php-version\">\n                <strong>PHP Version<\/strong>: 5.6            <\/span>\n        <\/div>\n\n        <!-- List of Included Shortcodes -->\n        <div class=\"plugin-shortcodes\">\n            <strong>Included Shortcodes:<\/strong>\n            <ul>\n                <li>[acfe_form]<\/li>            <\/ul>\n        <\/div>\n    <\/div>\n    <\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Advanced Custom Fields: Extended [acfe_form] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The ACF Extended plugin shortcode, &#8216;acfe_form&#8217;, is designed to render forms dynamically. It accepts an array of attributes, allowing customization of form and field attributes. \n\n\n\nThis shortcode decodes the attributes, checks for sub-array compatibility, and sets the attributes array accordingly. It then initiates output buffering, renders the form using the attributes, and returns the buffered output. This ensures the form is displayed correctly on the front-end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[acfe_form]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic Example<\/strong> &#8211; The shortcode displays a form using the ID attribute. This is a simple usage example that will render the form associated with the given ID.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[acfe_form id=\"1\" \/]<\/code><\/pre>\n\n\n<p><strong>Advanced Examples<\/strong><\/p>\n<p>Here, the shortcode is used to display a form by referencing both the ID and title. The form will first try to load by ID, but if not found, it will try to load by title.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[acfe_form id=\"1\" title=\"Contact Form\" \/]<\/code><\/pre>\n\n\n<p>In this example, additional attributes are added to customize the form&#8217;s HTML attributes. These attributes include class, id, and style. The form will be rendered with these HTML attributes.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[acfe_form id=\"1\" form_attributes_class=\"my-form\" form_attributes_id=\"my-form-id\" form_attributes_style=\"background-color: #f9f9f9;\" \/]<\/code><\/pre>\n\n\n<p>This example shows a form with field attributes. This allows for customization of individual fields within the form. The &#8216;name&#8217; field in this example will be rendered with the specified class and style.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[acfe_form id=\"1\" fields_attributes_name_class=\"my-field\" fields_attributes_name_style=\"color: #333;\" \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[acfe_form]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode('acfe_form',                          array($this, 'render_shortcode'));<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction render_shortcode($atts){\n        \n        \/\/ attributes array\n        $atts = acf_get_array($atts);\n        \n        \/\/ allow array atts\n        foreach(array_keys($atts) as $key){\n            \n            \/\/ sub array compatibility\n            foreach(array(&#039;form_attributes_&#039;, &#039;fields_attributes_&#039;) as $allowed){\n                \n                \/\/ check found allowed\n                if(!acfe_starts_with($key, $allowed)) continue;\n                \n                \/\/ explode\n                $explode = explode($allowed, $key);\n                $sub_key = $explode&#91;1];\n                \n                \/\/ set attributes array\n                $atts&#91; substr($allowed, 0, -1) ]&#91; $sub_key ] = $atts&#91; $key ];\n                unset($atts&#91; $key ]);\n                \n            }\n        \n        }\n        \n        \/\/ render\n        ob_start();\n    \n        acfe_form($atts);\n    \n        return ob_get_clean();\n    \n    }\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">acf-extended\/acf-extended\/includes\/modules\/form\/module-form-front.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that you&#8217;ve learned how to embed the <strong>Advanced Custom Fields: Extended Plugin shortcode<\/strong>, understood the parameters, and seen code examples, it&#8217;s easy to use and debug any issue that might cause it to &#8216;not work&#8217;. If you still have difficulties with it, don&#8217;t hesitate to leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Below, you&#8217;ll find a detailed guide on how to add the Advanced Custom Fields: Extended Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we&#8217;ll assist you with common issues that might cause the Advanced Custom Fields: Extended Plugin shortcode not to show or not to work correctly. Before starting, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"name":"Advanced Custom Fields: Extended","slug":"","version":"0.8.9.4","author":"<a href=\"https:\/\/www.acf-extended.com\">ACF Extended<\/a>","icons":"https:\/\/ps.w.org\/acf-extended\/assets\/icon-128x128.png?rev=2071550","plugin_tags":"{\"acf\":\"acf\",\"admin\":\"admin\",\"custom-fields\":\"custom fields\",\"fields\":\"fields\",\"meta\":\"meta\"}","author_profile":"https:\/\/profiles.wordpress.org\/hwk-fr\/","requires":"4.9","tested":"6.3.2","requires_php":"5.6","rating":94,"num_ratings":126,"active_installs":80000,"downloaded":1189995,"last_updated":"2023-09-29 7:09am GMT","added":"2019-03-18","homepage":"https:\/\/www.acf-extended.com","short_description":"All-in-one enhancement suite that improves WordPress &amp; Advanced Custom Fields.","description":"\"Advanced Custom Fields: Extended is a powerful WordPress plugin that enhances your website's custom fields. It offers advanced features like bidirectional relationships, post type selection, and more.\"","shortcodes":"[\"acfe_form\"]","footnotes":""},"categories":[1],"tags":[],"class_list":["post-469","post","type-post","status-publish","format-standard","hentry","category-plugins"],"_links":{"self":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/comments?post=469"}],"version-history":[{"count":1,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/469\/revisions"}],"predecessor-version":[{"id":612,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/469\/revisions\/612"}],"wp:attachment":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/media?parent=469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/categories?post=469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/tags?post=469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}