How WordPress implements Gzip compression

Everyone knows,Compression affects the overall loading speed of the website andSEOA significant improvement,But many people use plugins orcdnwhich providedGZIPDecompression,This may make the overall optimization of the website not obvious,It is inevitable if there are some bugs in the plug-in. About using codeGZIPcompression: 1、Put in the template directorystyle.cssMake a copy,namedstyle.css.php,Followed bystyle.css.phpAdd this sentence at the top: […]

WordPress gets statistics on the number of images in an article

as far as I knowWordPressThere is no function to count the number of pictures in the article,So if you want to get the total number of all pictures in the article, you can only add by yourselfWordPressCode to achieve。 This feature is not difficult to achieve, Just a few lines of code, There are many […]

WordPress batch change domain names in articles

This tutorial is packaged and replaced for my entire site,But it can also be used to change the domain name path when you move. such as Original domain name a.com Replace in bulk b.com Whole station packing download 2GB Start of the tutorial Entry path: themes/theme/functions.php Add the following code   function replace_text_wps($text){$replace = array(‘https://Old […]

How to prevent articles with duplicate titles from being published?

Prevent publication of articles with the same title  I usually post articles for external links or something,The webmasters are busy,Sometimes articles with the same title are published,At this time, you can use this string of codes to make a simple prediction.。 note:Recommend to use under traditional editor。 When you publish the article,Check for duplicate article […]

Manually open WordPress site maintenance mode

In an updater or plug-in,WordPressThe front end will show that it is in maintenance mode,If you want to temporarily enable maintenance mode,Let users know that your site is under maintenance,It can be realized by the following code。 openWordPressSite maintenance mode Add the following code to the current topic function templatefunctions.phpin: function zm_maintenancemode() { if ( […]

WordPress gets the subcategory of the current category

In productionWordPressWhen the theme is often met, how to be inWordPressThe category page displays the subcategories under the current category or displays the subcategories of the category on the article page,Especially when doing Chinese enterprise theme, we must use this skill。Today, I’d like to share with you the functions that I used to call subcategory […]

The method of forbidding the automatic saving of WordPress articles

Before, Xiao Bian talked about it《solveWordPressarticleidA simple method of discontinuity》Mentioned inWordPress自动保存article的时间间隔的问题,And today we are talking about direct prohibitionWordPressarticle自动保存的方法,The method is simple,And it’s focused onfuntions.phpIn the file,The advantage is thatwpThere is no need to reset after the version is updated! Now let’s ban this function! Put the following code in theWordPressThematic funtions.phpwithin,Pay attention to the last […]

WordPress using CSS3 to achieve page fade animation effects

utilizeCSS3Animation properties“@keyframes ”Can achieve some dynamic effects,Specific syntax and parameters can be learned online。这篇文章主要是实践应用一下这个Animation properties,Realize page fade in effect,On foxes24edition、chrome29edition、IE10Passed the test in the test。IE9The browser below does not support this effect。 Fade in code: @keyframes fade-in {         40% {opacity: 0;}     }         0% {opacity: 0;}         100% {opacity: 1;}     #wrapper {           animation-duration: 1.5s;     }   Add the above code directly to the topicstyleIn the style file,And modify […]