In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what the less-used WordPress template tags are, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Since WordPress appeared, it has provided us with a large number of template tags. These template tags belong to the PHP function and can be used to output and retrieve a piece of data. If you have developed WordPress themes, you should be familiar with some template tags, such as the the_title tag used to display the title of the article, the the_author tag used to display the name of the author of the article, etc.
WordPress has been evolving over the years, and each new release brings us some new template tags. Therefore, it is very difficult for anyone to master all the template tags at any time. In this article, we summarize some template tags that are often forgotten.
P should be capitalized.
According to its guidelines and standards, the "P" letter in WordPress must be capitalized (capital).
In 2009, Matt Mullenweg, the founder of WordPress, introduced the function capital_p_dangit () to get people to spell the name correctly.
/ / you can use this function directly
$footer_text = get_theme_mod ("footer_text", ""); $footer_text = captial_p_dangit ($footer_text); / / Any WordPress text is turned with capital P. / / or use add_filter in WordPress Filter ("the_excerpt", function ($text) {return captial_p_dangit ($text);})
Custom Logo
In version 4.5, WordPress introduced the ability to upload logo as a theme in Customizer. This new feature requires theme support: by adding add_theme_support ('site-logo'), the logo will appear in Customizer.
With the advent of this feature, we can use some new template tags that can handle the output of logo images on the theme: has_custom_logo (), get_custom_logo (), and the_custom_logo ().
/ / 1. The output includes the image logo and the connection back to the home page the_custom_logo (); / / 2. Get a custom logo output "string" $logo = get_custom_logo (); / / 3. Condition if (has_custom_logo ()) {$logo = get_custom_logo ();} / / 4. Use 'get_custom_logo' to package logo in div add_filter ("get_custom_logo", function ($html) {return''. $html.';})
Thumbnail URL
For a long time, WordPress has the ability to add thumbnails or feature images. The template tag the_post_thumbnail () displays the value of the image tag as well as the image tag. But what if you want to use CSS to set thumbnails as the background? You can use this label:
Get_the_post_thumbnail_url ().
Example:
'ol',' short_ping' = > true, 'avatar_size' = > 42,)); > above are all the contents of this article entitled "what are the less used WordPress template tags?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.