{"id":27541,"date":"2016-08-03T23:03:18","date_gmt":"2016-08-03T15:03:18","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=27541"},"modified":"2025-04-04T00:04:04","modified_gmt":"2025-04-03T16:04:04","slug":"wordpress-template-tags","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/","title":{"rendered":"10 WordPress Template Tags You May Not Know"},"content":{"rendered":"<p>WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to <strong>output<\/strong> as well as <strong>retrieve a piece of data<\/strong>.<\/p>\n<p>If you have been developing a WordPress theme, you may be familiar with some of these Template Tags, such as <code>the_title<\/code> that shows the post title, <code>the_author<\/code> that shows the name of the post\u2019s author, and the link of the post.<\/p>\n<p>WordPress keeps evolving. Every new release often introduces a few new Template Tags. So much so that keeping up with all these Template Tags \u2014 both old and new \u2014 can be quite challenging. Check out these 20 template tags you might have overlooked.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/wordpress-custom-template-tags\/\">How to Create Custom WordPress Template Tags<\/a>\n\t\t\t\t<\/p>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/capital_p_dangit\/\" rel=\"noopener\">Capital P<\/a><\/h3>\n<p><em>WordPress<\/em>, as per their guideline and standard, <strong>has to<\/strong> be written with the capital P i.e. WordPress is a no-no; the right way is to spell it as <em>WordPress<\/em>.<\/p>\n<p>The capital \u201cP\u201d is an issue with so much importance to the extend that Matt Mullenweg (founder of WordPress) has included it in <a target=\"_blank\" href=\"https:\/\/ma.tt\/2009\/01\/twenty-five\/\" rel=\"noopener\">his resolution back in 2009<\/a>. The <code>capital_p_dangit()<\/code> function is introduced as part of the initiative.<\/p>\n<p><strong>Since<\/strong>: 3.0.0<\/p>\n<pre>\r\n\/\/ Using it straightforwardly\r\n$footer_text = get_theme_mod( \"footer_text\", \"\" );\r\n$footer_text = captial_p_dangit( $footer_text ); \/\/ Any WordPress text is turned with capital P.\r\n\r\n\/\/ Or, using it in a WordPress Filter.\r\nadd_filter( \"the_excerpt\", function( $text ) {\r\n \treturn captial_p_dangit( $text );\r\n} );\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/the_custom_logo\/\" rel=\"noopener\">Custom Logo<\/a><\/h3>\n<p>In 4.5, WordPress introduced the ability to upload a <a target=\"_blank\" href=\"https:\/\/make.wordpress.org\/core\/2016\/02\/24\/theme-logo-support\/\" rel=\"noopener\">logo for themes through the Customizer<\/a>. This new feature requires theme support: by adding <code>add_theme_support( 'site-logo' )<\/code>, the logo will  appear in the Customizer.<\/p>\n<p>This feature leads to the use of a few new Template Tags that can handle the logo image output on Themes, namely: <code>has_custom_logo()<\/code>, <code>get_custom_logo()<\/code>, and <code>the_custom_logo()<\/code>.<\/p>\n<p><strong>Since<\/strong>: 4.5.0<\/p>\n<pre>\r\n\/\/ 1. Output includes the image logo and the link back to home.\r\nthe_custom_logo();\r\n\r\n\/\/ 2. Get the custom logo output \"string\".\r\n$logo = get_custom_logo();\r\n\r\n\/\/ 3. Conditional\r\nif ( has_custom_logo() ) {\r\n\t$logo = get_custom_logo();\r\n}\r\n\r\n\/\/ 4. Using the 'get_custom_logo' to wrap the logo with a div;\r\nadd_filter( \"get_custom_logo\", function( $html ) {\r\n\treturn '<div class=\"site-logo\">'. $html .'<\/div>';\r\n} );\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_the_post_thumbnail_url\/\" rel=\"noopener\">Thumbnail Image URL<\/a><\/h3>\n<p>WordPress has a long-integrated, native utility to add a thumbnail image or  featured image. The Template Tag, <code>the_post_thumbnail()<\/code>, shows the image tag along with their attributes.<\/p>\n<p>But what if you want to show the image thumbnail as a background through CSS instead? Use the Template Tag, <code>get_the_post_thumbnail_url()<\/code>.<\/p>\n<p><strong>Since<\/strong>: 4.4.0<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\n&lt;?php echo get_the_post_thumbnail_url(); \/\/ e.g. \"http:\/\/example.com\/path\/to\/image\/thumbnail.jpg\"?&gt;\r\n\r\n&lt;div class=\"image-thumbnail\" style=\"background-image; url(&lt;?php echo get_the_post_thumbnail_url() ?&gt;)\"&gt;&lt;\/div&gt;\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_rand\/\" rel=\"noopener\">Generate Random Number<\/a><\/h3>\n<p>This Template Tag will give you a random number based on a specified range. WordPress  is using this function internally to generate a random password. You can probably use it to generate a random coupon number for your WooCommerce site.<\/p>\n<p><strong>Since<\/strong>: 2.6.2<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\n\/\/ Generate a number from 1 to 200\r\n$rand_number = wp_rand( 1, 200 ); \/\/ output will not be below 0 or 201 above.\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/the_comments_pagination\/\" rel=\"noopener\">Comments Pagination<\/a><\/h3>\n<p>Most Themes are currently using the <code>the_comments_navigation()<\/code> which will give the \u201cNext\u201d and \u201cPrev\u201d type of navigation link. If you want to show a numbered navigation (pagination), replace the tag with <code>the_comments_pagination()<\/code> instead.<\/p>\n<p>Bear in mind that the Template Tag is only available in WordPress 4.4.0 upwards. Make sure to run a check before deploying it.<\/p>\n<p><strong>Since<\/strong>: 4.4.0<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\n&lt;?php\r\n\/\/ Replace the `the_comments_navigation()`\r\nif ( function_exists( 'the_comments_pagination' ) ) {\r\n\tthe_comments_pagination();\r\n} else {\r\n\tthe_comments_navigation();\r\n}\r\n\r\n&lt;ol class=\"comment-list\"&gt;\r\n\t&lt;?php\r\n\t\twp_list_comments( array(\r\n\t\t\t'style'       =&gt; 'ol',\r\n\t\t\t'short_ping'  =&gt; true,\r\n\t\t\t'avatar_size' =&gt; 42,\r\n\t\t) );\r\n\t?&gt;\r\n&lt;\/ol&gt;\r\n\r\n&lt;!-- .comment-list --&gt;\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/url_shorten\/\" rel=\"noopener\">Shortening URL<\/a><\/h3>\n<p>This Template Tag will shorten a url length. <a target=\"_blank\" href=\"https:\/\/css-tricks.com\/snippets\/css\/prevent-long-urls-from-breaking-out-of-container\/\" rel=\"noopener\">And such a very long URL won\u2019t break into a new line<\/a> within the body content. There are 2 options you can take: add <code>overflow-wrap: break-word;<\/code> in your CSS, or trim the length of the URL with the <code>url_shorten()<\/code> Template Tag.<\/p>\n<p><strong>Since<\/strong>: 1.2.0<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\n$link = get_the_permalink();\r\n$url_text = url_shorten( $link ); \/\/ e.g. www.hongkiat.com\/blog\/css...\r\necho '&lt;a href=\"'. $link .'\"&gt;'. $url_text .'&lt;\/a&gt;';\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_add_inline_script\/\" rel=\"noopener\">Add Inline Scripts<\/a><\/h3>\n<p>We have always used the <code>wp_enqueue_script<\/code> to register, load a script and its dependencies. <strong>Loading an internal script<\/strong> however was not quite straightforward, until this Template Tag, <code>wp_add_inline_script<\/code> is introduced.<\/p>\n<p>Adding an inline script requires a known enqueued script to which it will be attached. This <em>handler<\/em> is passed as the first parameter of the script similar to the <code>wp_localize_script()<\/code> function. The second parameter should pass the content of the script. The third parameters specifiy whether the inline should be output \u2018before\u2019 or \u2018after\u2019 .<\/p>\n<p><strong>Since<\/strong>: 4.5.0<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\nfunction enqueue_script() {\r\n   wp_enqueue_script( 'twentysixteen-script', get_template_directory_uri() . '\/js\/functions.js', array( 'jquery' ), '20160412', true );\r\n\twp_add_inline_script( 'twentysixteen-script', 'window.hkdc = {}', 'before' );\r\n}\r\nadd_action( 'wp_enqueue_scripts', 'enqueue_script' );\r\n\r\n\/\/ Output:\r\n\/\/ &lt;script type='text\/javascript'&gt;window.hkdc = {}&lt;\/script&gt;\r\n\/\/ &lt;script type='text\/javascript' src='http:\/\/local.wordpress.dev\/wp-content\/themes\/twentysixteen\/js\/functions.js?ver=20160412'&gt;&lt;\/script&gt;\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_dropdown_languages\/\" rel=\"noopener\">Dropdown Language<\/a><\/h3>\n<p>The <code>wp_dropdown_languages<\/code> Template Tag will output an HTML option showing a list of languages in your WordPress site. You will find this template tag useful if you need to localize your website. You can use it to show your language options in the <em>User Editor<\/em> screen or in the front-end of your site to allow users to select their language preference.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/wordpress-template-tags\/languages-options.jpg\" height=\"360\" width=\"700\" alt=\"List options of available language in User setting.\"><\/figure>\n<p><strong>Since<\/strong>: 4.0.0<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\nwp_dropdown_languages( array(\r\n    'id' =&gt; 'lang_options',\r\n    'name' =&gt; 'lang_options',\r\n    'languages' =&gt; get_available_languages(),\r\n    'translations' =&gt; array( 'id_ID', 'ja' ), \/\/ Indonesia, and Japan\r\n    'selected' =&gt; 'en_US',\r\n    'show_available_translations' =&gt; false,\r\n    )\r\n);\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_avatar_url\/\" rel=\"noopener\">Get the Avatar Image URL<\/a><\/h3>\n<p>As the name suggests, this Template Tag, <code>get_avatar_url()<\/code>, will <a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/wordpress-gravatar-image-url\/\" rel=\"noopener\">retrieve the image path of the user\u2019s avatar<\/a>. It allows you to display and mold the avatar in any way you like, instead of simply displaying it through the HTML image tag.<\/p>\n<p><strong>Since<\/strong>: 4.2.0<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\n$avatar = get_avatar_url( 'admin@domain.com' );\r\n&lt;div class=\"avatar-url\" style=\"background-image: url(&lt;?php echo $avatar; ?&gt;)\"&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<h3><a target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_get_theme\/\" rel=\"noopener\">Get Theme<\/a><\/h3>\n<p>This function retrieves an object containing information of the  currently active Theme. This information includes the theme Slug, Name, Version, Text Domain, Author, etc.<\/p>\n<p>In the following code snippet, we use it to retrieve the version and pass it as the script version.<\/p>\n<p><strong>Since<\/strong>: 3.4.0<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<pre>\r\n$theme = wp_get_theme();\r\ndefine( 'THEME_SLUG', $theme-&gt;template ); \/\/twentysixteen\r\ndefine( 'THEME_NAME', $theme-&gt;get( 'Name' ) ); \/\/ Twenty Sixteen\r\ndefine( 'THEME_VERSION', $theme-&gt;get( 'Version' ) ); \/\/1.2\r\n\r\nfunction load_scripts() {\r\n\twp_enqueue_script( 'script-ie', $templateuri .'js\/ie.js', array( \"jquery\" ), THEME_VERSION );\r\n\twp_script_add_data( 'script-ie', 'conditional', 'lt IE 9' );\r\n}\r\nadd_action( 'wp_enqueue_scripts', 'load_scripts' );\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to output as well as retrieve a piece of data. If you have been developing a WordPress theme, you may be familiar with some of these Template Tags, such as&hellip;<\/p>\n","protected":false},"author":113,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49],"tags":[4663,2873],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>10 WordPress Template Tags You May Not Know - Hongkiat<\/title>\n<meta name=\"description\" content=\"WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to\" \/>\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.hongkiat.com\/blog\/wordpress-template-tags\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"10 WordPress Template Tags You May Not Know\" \/>\n<meta property=\"og:description\" content=\"WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-03T15:03:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T16:04:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/wordpress-template-tags\/languages-options.jpg\" \/>\n<meta name=\"author\" content=\"Thoriq Firdaus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tfirdaus\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thoriq Firdaus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/\"},\"author\":{\"name\":\"Thoriq Firdaus\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\"},\"headline\":\"10 WordPress Template Tags You May Not Know\",\"datePublished\":\"2016-08-03T15:03:18+00:00\",\"dateModified\":\"2025-04-03T16:04:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/\"},\"wordCount\":699,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-template-tags\\\/languages-options.jpg\",\"keywords\":[\"ad-divi\",\"wordpress admin\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/\",\"name\":\"10 WordPress Template Tags You May Not Know - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-template-tags\\\/languages-options.jpg\",\"datePublished\":\"2016-08-03T15:03:18+00:00\",\"dateModified\":\"2025-04-03T16:04:04+00:00\",\"description\":\"WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-template-tags\\\/languages-options.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-template-tags\\\/languages-options.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-template-tags\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"10 WordPress Template Tags You May Not Know\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\",\"name\":\"Thoriq Firdaus\",\"description\":\"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.\",\"sameAs\":[\"https:\\\/\\\/thoriq.com\",\"https:\\\/\\\/x.com\\\/tfirdaus\"],\"jobTitle\":\"Web Developer\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/thoriq\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"10 WordPress Template Tags You May Not Know - Hongkiat","description":"WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to","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.hongkiat.com\/blog\/wordpress-template-tags\/","og_locale":"en_US","og_type":"article","og_title":"10 WordPress Template Tags You May Not Know","og_description":"WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to","og_url":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2016-08-03T15:03:18+00:00","article_modified_time":"2025-04-03T16:04:04+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-template-tags\/languages-options.jpg","type":"","width":"","height":""}],"author":"Thoriq Firdaus","twitter_card":"summary_large_image","twitter_creator":"@tfirdaus","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Thoriq Firdaus","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/"},"author":{"name":"Thoriq Firdaus","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807"},"headline":"10 WordPress Template Tags You May Not Know","datePublished":"2016-08-03T15:03:18+00:00","dateModified":"2025-04-03T16:04:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/"},"wordCount":699,"commentCount":6,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-template-tags\/languages-options.jpg","keywords":["ad-divi","wordpress admin"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/","url":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/","name":"10 WordPress Template Tags You May Not Know - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-template-tags\/languages-options.jpg","datePublished":"2016-08-03T15:03:18+00:00","dateModified":"2025-04-03T16:04:04+00:00","description":"WordPress is shipped with quite an abundance of Template Tags since its inception. These Template Tags in WordPress are PHP functions that can be used to","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-template-tags\/languages-options.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-template-tags\/languages-options.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-template-tags\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"10 WordPress Template Tags You May Not Know"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807","name":"Thoriq Firdaus","description":"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.","sameAs":["https:\/\/thoriq.com","https:\/\/x.com\/tfirdaus"],"jobTitle":"Web Developer","url":"https:\/\/www.hongkiat.com\/blog\/author\/thoriq\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-7ad","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/27541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=27541"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/27541\/revisions"}],"predecessor-version":[{"id":73482,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/27541\/revisions\/73482"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=27541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=27541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=27541"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=27541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}