present day,WPThe forest brings you a more convenientWordPressEdit shortcode function,This in the earlyWordPressBlog topic,Basically will add,And because of the trouble,After a long period of time, no developer added. And the new way I teach you,Can make it more convenient for you to add,No picture, no truth,Look at the picture: Front-end style: Background use and add: […]
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 creates a temporary administrator to log in to the background
Do you need to create a temporary account to log in to your website backend?If you create a permanent administrator and forget to clean up,Then users who are allowed to log in to the backend do tricks on your website? If you have some problems with your website,Need Alibaba Cloud Engineer、Tencent Cloud engineers provide technical […]
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 […]
WordPress non-regular get the first image of the article
Circulated onlineWordPressThe method of obtaining the first picture of the article as a thumbnail is achieved by using regular matching crawling,code show as below: function catch_that_image() { global $post, $posts; $first_img = ”; ob_start(); ob_end_clean(); $output = preg_match_all(‘/<img.+src=[‘”]([^'”]+)[‘”].*>/i’, $post->post_content, $matches); $first_img = $matches[1][0]; if(empty($first_img)){ $first_img = ‘/images/default.jpg’; } return $first_img; } Some people say that […]
Enable the font rendering of the browser
Font rendering in the browser stayabout:configSearch incleartype,The following items were found gfx.font_rendering.cleartype_params.gamma gamma value 1000 reach 2200 gfx.font_rendering.cleartype_params.enhanced_contrast Font contrast(What I set up here is200,Set according to personal preference,没发现最大value是多少) gfx.font_rendering.cleartype_params.cleartype_level cleartypeGrade 0 reach 100 gfx.font_rendering.cleartype_params.pixel_structure 0 = flat, 1 = RGB, 2 = BGR Liquid crystalRGB,choice1 gfx.font_rendering.cleartype_params.rendering_mode 0 = default, 1 = aliased, 2 = […]
Method of forbidding to view web page source code
There are always novices asking,How to prohibit others to view their own web page source code?The answer is No,For the experienced, all methods are futile。 Method of forbidding to view web page source code The common method is to add a similar pageJScode,Shielding keyboard and right mouse button。 document.onkeydown = function() { var e = […]
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 ( […]