Last update at :2024-06-12,Edit by888u
Friends who use WordPress to build websites know that when writing articles, there is a "tag" function on the right side of the default WordPress article editing column. We can fill in the corresponding "tags" for the blog posts we will publish. In fact, WordPress article "tags" are very helpful for SEO optimization. Not much to say here. Due to some problems encountered recently, it is necessary to batch modify the number of "tags" of published blog posts. If we limit the number of tags displayed in each article, you can set it through the following method.
The first step is to find "single.php" in the topic article
The second step is to search for "the_tags" in the "single.php" file and find code such as "the_tags(", ‘, ‘, ”);”.
The third step is to modify the "the_tags(", ', ', ");" code to the following code.
What needs to be noted in this step is that the number "3" in the code below can be modified according to your own needs. If the default is three, only 2 labels will be displayed. If you want to display 3 labels, just set it to 4. . As shown in the picture below, the Snail setting is 21, so each article only displays a maximum of 20 tags.
$posttags = get_the_tags();$count=0;if($posttags) {foreach($posttags as $tag) {$count++;if($count<3){echo \'\' . $tag->name . \' \';}}}Recommended site search: registration number, domain name registration inquiry domain name free registration 0 yuan registration, registration number, website server, online shop virtual host, server high defense Hong Kong, Taiwan server rental, Chinese international domain name, website registration,
发表评论