{"id":4093,"date":"2019-08-30T15:10:52","date_gmt":"2019-08-30T20:10:52","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=4093"},"modified":"2021-08-16T15:57:23","modified_gmt":"2021-08-16T19:57:23","slug":"wp-meta-to-theme","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/","title":{"rendered":"How to Add Custom Fields to a WordPress Theme"},"content":{"rendered":"<p>Did you know that you could add custom data to posts in WordPress? Technically, we\u2019re talking about metadata, which is basically data about data. With WordPress, you can add metadata to a post using <strong>custom fields<\/strong>. Using custom fields basically lets you add more information about a post.<\/p>\n<p>WordPress lets you display custom metadata alongside post content. For example, if you\u2019re a blogger who writes about books, you can add a custom field for the book you\u2019re currently reading. Likewise, these fields can be used to set a <em>mood<\/em> or even to display a <em>rating<\/em> for a product or service.<\/p>\n<p>There is no limit to the kind of metadata you can add about your posts. However, most themes do not come with custom field support by default. Support for custom fields will usually require some coding. You can add the code manually to theme files or as a plugin.<\/p>\n<p>However, in this article, we will provide an easy code snippet you can copy and paste into the <code>functions.php<\/code> file for any theme you are using. Then, all you need to do is add the shortcode \u201c[meta]\u201d to any post, and you will see a list of your post meta appear with the post content.<\/p>\n<h2>How to Add Custom Meta to the Theme\u2019s Function File<\/h2>\n<ol class=\"article_list\">\n<li><a href=\"\/support\/images\/stories\/wordpress\/Selection_087-cm-wpblank.png\"><img loading=\"lazy\" decoding=\"async\" class=\"std_ss alignnone\" style=\"float: right; margin: 0px 15px 15px 15px; width: 200px;\" src=\"\/support\/images\/stories\/wordpress\/Selection_087-cm-wpblank.png\" alt=\"\" width=\"529\" height=\"540\"><\/a><a href=\"\/support\/edu\/wordpress\/logging-into-wordpress-dashboard\/\">Log into WordPress Dashboard<\/a>\n<div style=\"clear: both;\"><\/div>\n<\/li>\n<li>Use your favorite <a href=\"\/support\/website\/how-to-manage-files-server\/\">file management<\/a> method to access the <code>functions.php<\/code> file in your theme directory<\/li>\n<li><!-- wpMeta_02.png --><a href=\"\/support\/images\/stories\/wordpress\/meta\/wpMeta_02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"std_ss alignnone\" style=\"float: right; margin: 0px 15px 15px 15px; width: 200px;\" src=\"\/support\/images\/stories\/wordpress\/meta\/wpMeta_02.png\" alt=\"\" width=\"500\" height=\"400\"><\/a>Add this code to the <code>functions.php<\/code> file:\n<pre class=\"code_block\">function easyWPMetaShortcodeFun()\n{echo the_meta(); } \nadd_shortcode('meta', 'easyWPMetaShortcodeFun');<\/pre>\n<div style=\"clear: both;\"><\/div>\n<\/li>\n<li><!-- wpMeta_04.png --><a href=\"\/support\/images\/stories\/wordpress\/meta\/wpMeta_04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"std_ss alignnone\" style=\"float: right; margin: 0px 15px 15px 15px; width: 200px;\" src=\"\/support\/images\/stories\/wordpress\/meta\/wpMeta_04.png\" alt=\"\" width=\"653\" height=\"444\"><\/a>Add this shortcode to any post that you wish to display custom fields for: <code>[meta]<\/code>\n<div style=\"clear: both;\"><\/div>\n<\/li>\n<\/ol>\n<p>You should now know how to add custom meta fields to posts in your WordPress site. For more detailed information about adding and editing post meta for WordPress, you are best advised to check out the <a href=\"https:\/\/codex.wordpress.org\/Custom_Fields\">WordPress Codex regarding custom fields<\/a>.<\/p>\n\n<p>Learn more about the power of <a href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/\">WordPress Themes<\/a> and how they can simplify your website building and maintenance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Did you know that you could add custom data to posts in WordPress? Technically, we\u2019re talking about metadata, which is basically data about data. With WordPress, you can add metadata to a post using custom fields. Using custom fields basically lets you add more information about a post. WordPress lets you display custom metadata alongside<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\"> Read More ><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4380],"tags":[],"class_list":["post-4093","post","type-post","status-publish","format-standard","hentry","category-themes"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Add Custom Fields to a WordPress Theme | InMotion Hosting<\/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.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add Custom Fields to a WordPress Theme | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Did you know that you could add custom data to posts in WordPress? Technically, we\u2019re talking about metadata, which is basically data about data. With WordPress, you can add metadata to a post using custom fields. Using custom fields basically lets you add more information about a post. WordPress lets you display custom metadata alongside Read More &gt;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-30T20:10:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-16T19:57:23+00:00\" \/>\n<meta name=\"author\" content=\"Christopher Maiorana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Maiorana\" \/>\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.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\"},\"author\":{\"name\":\"Christopher Maiorana\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\"},\"headline\":\"How to Add Custom Fields to a WordPress Theme\",\"datePublished\":\"2019-08-30T20:10:52+00:00\",\"dateModified\":\"2021-08-16T19:57:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\"},\"wordCount\":308,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Themes\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\",\"name\":\"How to Add Custom Fields to a WordPress Theme | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2019-08-30T20:10:52+00:00\",\"dateModified\":\"2021-08-16T19:57:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Add Custom Fields to a WordPress Theme\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\",\"name\":\"Christopher Maiorana\",\"description\":\"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Add Custom Fields to a WordPress Theme | InMotion Hosting","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.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/","og_locale":"en_US","og_type":"article","og_title":"How to Add Custom Fields to a WordPress Theme | InMotion Hosting","og_description":"Did you know that you could add custom data to posts in WordPress? Technically, we\u2019re talking about metadata, which is basically data about data. With WordPress, you can add metadata to a post using custom fields. Using custom fields basically lets you add more information about a post. WordPress lets you display custom metadata alongside Read More >","og_url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2019-08-30T20:10:52+00:00","article_modified_time":"2021-08-16T19:57:23+00:00","author":"Christopher Maiorana","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Christopher Maiorana","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/"},"author":{"name":"Christopher Maiorana","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f"},"headline":"How to Add Custom Fields to a WordPress Theme","datePublished":"2019-08-30T20:10:52+00:00","dateModified":"2021-08-16T19:57:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/"},"wordCount":308,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Themes"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/","url":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/","name":"How to Add Custom Fields to a WordPress Theme | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2019-08-30T20:10:52+00:00","dateModified":"2021-08-16T19:57:23+00:00","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/wordpress\/themes\/wp-meta-to-theme\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Add Custom Fields to a WordPress Theme"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f","name":"Christopher Maiorana","description":"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.","sameAs":["https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4093"}],"version-history":[{"count":8,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4093\/revisions"}],"predecessor-version":[{"id":83250,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4093\/revisions\/83250"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}