{"id":104,"date":"2018-07-21T01:18:10","date_gmt":"2018-07-21T01:18:10","guid":{"rendered":"http:\/\/www.projectimmerse.com\/?p=104"},"modified":"2020-06-17T01:26:28","modified_gmt":"2020-06-17T01:26:28","slug":"wordpress-advanced-custom-fields","status":"publish","type":"post","link":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/","title":{"rendered":"WordPress &#8211; Advanced Custom Fields"},"content":{"rendered":"<p><a href=\"https:\/\/www.advancedcustomfields.com\/\" title=\"Advanced Custom Fields Official Site\">Advanced Custom Fields (Official Site)<\/a>, this plugin is way too awesome not to mention. I&#8217;ve run into this <a href=\"https:\/\/wordpress.org\/plugins\/advanced-custom-fields\/\" title=\"Advanced Custom Fields \">WordPress Plugin (Plugin Page)<\/a> over a dozen times in the course of my development work &#8211; I started realizing how powerful, flexible and stable this Plugin really is. <\/p>\n<p>If you&#8217;re looking to add &#8220;Advanced&#8221;, &#8220;Custom&#8221;, &#8220;Fields&#8221; to your pages as the name suggests you&#8217;ll find a slick easy to use interface. Simply add the fields you want for your pages.<\/p>\n<h2>WordPress (backend) &#8211; Advanced Custom Fields Options<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.projectimmerse.com\/wp-content\/uploads\/2018\/07\/acf-field-group-300x214.png\" alt=\"\" width=\"300\" height=\"214\" class=\"aligncenter size-medium wp-image-106\" srcset=\"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/acf-field-group-300x214.png 300w, https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/acf-field-group-768x548.png 768w, https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/acf-field-group-1024x731.png 1024w, https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/acf-field-group-80x57.png 80w, https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/acf-field-group.png 1438w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>I myself thought I was all done &#8211; In this second step you&#8217;ll have to get your hands dirty with some PHP. Yeah this might be a little daunting if you aren&#8217;t tech savvy but you&#8217;ll be thankful you did, this all sounds cliche but for real practice makes perfect.<\/p>\n<p><!--more--><\/p>\n<p>What you want to do is look for the PHP template file &#8211; something like page.php or even something custom like page_shop.php. This page is where you want your custom fields to appear. <\/p>\n<p>Place the code in the desired section of the file and you have your custom field appearing on your page like you envisioned. I get a sigh of relief every time.  <\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\t\t\t\t\t\t\t\t\t\t&lt;?php\r\n\t\t\t\t\t\t\t\t\t\t\t$custom_link_field = get_post_meta($post-&gt;ID, 'custom_link', true);\r\n\t\t\t\t\t\t\t\t\t\t\t$custom_link_name_field = get_post_meta($post-&gt;ID, 'custom_link_name', true);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif (!empty($custom_link_field) &amp;&amp; !empty($custom_link_name_field)) {\r\n\t\t\t\t\t\t\t\t\t\t?&gt;\r\n\t\t\t\t\t\t\t\t\t\t&lt;a id=&quot;custom_link_button&quot; href=&quot;&lt;?php echo get_post_meta( $post-&gt;ID, 'custom_link', true ); ?&gt;&quot;&gt;&lt;?php echo get_post_meta( $post-&gt;ID, 'custom_link_name', true ); ?&gt;&lt;\/a&gt;\r\n\r\n\t\t\t\t\t\t\t\t\t&lt;?php } ?&gt;\r\n\r\n<\/pre>\n<p>The important thing to note here which isn&#8217;t specific to Advanced Custom Fields but more of a &#8220;best practices to PHP&#8221; is first making sure the fields exist. Using the empty function below, we first check to see that the fields actually exist (that they were created in step 1).<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nif (!empty($custom_link_field) &amp;&amp; !empty($custom_link_name_field)) {\r\n \/\/ the code\r\n}\r\n<\/pre>\n<p>What this is saying in plain simple terms is &#8211; &#8220;Hey let&#8217;s first check to see if the custom_link_field AND custom_link_name_field actually isn&#8217;t empty, if so then it&#8217;s safe to proceed with the following code block. Pretty awesome stuff.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Advanced Custom Fields (Official Site), this plugin is way too awesome not to mention. I&#8217;ve run into this WordPress Plugin (Plugin Page) over a dozen times in the course of my development work &#8211; I started realizing how powerful, flexible and stable this Plugin really is. If you&#8217;re looking to add &#8220;Advanced&#8221;, &#8220;Custom&#8221;, &#8220;Fields&#8221; to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WordPress &#8211; Advanced Custom Fields&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1125,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-104","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Wordpress - Advanced Custom Fields - Project Immerse<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wordpress - Advanced Custom Fields - Project Immerse\" \/>\n<meta property=\"og:description\" content=\"Advanced Custom Fields (Official Site), this plugin is way too awesome not to mention. I&#8217;ve run into this WordPress Plugin (Plugin Page) over a dozen times in the course of my development work &#8211; I started realizing how powerful, flexible and stable this Plugin really is. If you&#8217;re looking to add &#8220;Advanced&#8221;, &#8220;Custom&#8221;, &#8220;Fields&#8221; to &hellip; Continue reading &quot;WordPress &#8211; Advanced Custom Fields&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/\" \/>\n<meta property=\"og:site_name\" content=\"Project Immerse\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-21T01:18:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-17T01:26:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/advanced-custom-fields-wordpress-plugin.png\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"750\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"projectimmerse\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"projectimmerse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/\"},\"author\":{\"name\":\"projectimmerse\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"headline\":\"WordPress &#8211; Advanced Custom Fields\",\"datePublished\":\"2018-07-21T01:18:10+00:00\",\"dateModified\":\"2020-06-17T01:26:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/\"},\"wordCount\":414,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/advanced-custom-fields-wordpress-plugin.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/\",\"name\":\"Wordpress - Advanced Custom Fields - Project Immerse\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/advanced-custom-fields-wordpress-plugin.png\",\"datePublished\":\"2018-07-21T01:18:10+00:00\",\"dateModified\":\"2020-06-17T01:26:28+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/advanced-custom-fields-wordpress-plugin.png\",\"contentUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/advanced-custom-fields-wordpress-plugin.png\",\"width\":750,\"height\":750,\"caption\":\"WordPress \u2013 Advanced Custom Fields\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wordpress-advanced-custom-fields\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress &#8211; Advanced Custom Fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\",\"name\":\"Project Immerse\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\",\"name\":\"projectimmerse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"caption\":\"projectimmerse\"},\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/author\\\/projectimmerse\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wordpress - Advanced Custom Fields - Project Immerse","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/","og_locale":"en_US","og_type":"article","og_title":"Wordpress - Advanced Custom Fields - Project Immerse","og_description":"Advanced Custom Fields (Official Site), this plugin is way too awesome not to mention. I&#8217;ve run into this WordPress Plugin (Plugin Page) over a dozen times in the course of my development work &#8211; I started realizing how powerful, flexible and stable this Plugin really is. If you&#8217;re looking to add &#8220;Advanced&#8221;, &#8220;Custom&#8221;, &#8220;Fields&#8221; to &hellip; Continue reading \"WordPress &#8211; Advanced Custom Fields\"","og_url":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/","og_site_name":"Project Immerse","article_published_time":"2018-07-21T01:18:10+00:00","article_modified_time":"2020-06-17T01:26:28+00:00","og_image":[{"width":750,"height":750,"url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/advanced-custom-fields-wordpress-plugin.png","type":"image\/png"}],"author":"projectimmerse","twitter_card":"summary_large_image","twitter_misc":{"Written by":"projectimmerse","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#article","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/"},"author":{"name":"projectimmerse","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"headline":"WordPress &#8211; Advanced Custom Fields","datePublished":"2018-07-21T01:18:10+00:00","dateModified":"2020-06-17T01:26:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/"},"wordCount":414,"commentCount":0,"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/advanced-custom-fields-wordpress-plugin.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/","url":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/","name":"Wordpress - Advanced Custom Fields - Project Immerse","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#primaryimage"},"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/advanced-custom-fields-wordpress-plugin.png","datePublished":"2018-07-21T01:18:10+00:00","dateModified":"2020-06-17T01:26:28+00:00","author":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"breadcrumb":{"@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#primaryimage","url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/advanced-custom-fields-wordpress-plugin.png","contentUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2018\/07\/advanced-custom-fields-wordpress-plugin.png","width":750,"height":750,"caption":"WordPress \u2013 Advanced Custom Fields"},{"@type":"BreadcrumbList","@id":"https:\/\/www.projectimmerse.com\/blog\/wordpress-advanced-custom-fields\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.projectimmerse.com\/blog\/"},{"@type":"ListItem","position":2,"name":"WordPress &#8211; Advanced Custom Fields"}]},{"@type":"WebSite","@id":"https:\/\/www.projectimmerse.com\/blog\/#website","url":"https:\/\/www.projectimmerse.com\/blog\/","name":"Project Immerse","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.projectimmerse.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5","name":"projectimmerse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","caption":"projectimmerse"},"url":"https:\/\/www.projectimmerse.com\/blog\/author\/projectimmerse\/"}]}},"_links":{"self":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":2,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"predecessor-version":[{"id":466,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/104\/revisions\/466"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media\/1125"}],"wp:attachment":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}