Insert the following code into the functions. php file. remember to insert it to & lt ;? Php and? & Gt; otherwise, an error occurs: // number of connections $ match_num_from1; // do not replace $ match_num_to10 if there is less than one keyword; // a keyword can be replaced at most // module a connected to WordPress
Insert the following code into the functions. php file. remember to insert it Otherwise, an error occurs:
// Number of connections $ match_num_from = 1; // do not replace $ match_num_to = 10 if there is less than one keyword; // a keyword can be replaced at most // add_filter ('The _ content', 'tag _ link', 1) of the WordPress module; // function tag_sort ($, $ B) {if ($ a-> name = $ B-> name) return 0; return (strlen ($ a-> name)> strlen ($ B-> name ))? -1: 1;} // change the tag keyword function tag_link ($ content) {global $ match_num_from, $ match_num_to; $ posttags = get_the_tags (); if ($ posttags) {usort ($ posttags, "tag_sort"); foreach ($ posttags as $ tag) {$ link = get_tag_link ($ tag-> term_id ); $ keyword = $ tag-> name; // connection code $ cleankeyword = stripslashes ($ keyword); $ url = "". addcslashes ($ cleankeyword, '$ '). ""; $ limit = rand ($ match_num_from, $ match_num_to); // code without connection $ content = preg_replace ('| (] +> )(. *)('. $ ex_word. ')(. *)(] *>) | U '. $ case, '$1 $ 2% & % $4 $ 5', $ content); $ content = preg_replace (' | () | U '. $ case, '$1 $ 2% & % $4 $ 5', $ content); $ cleankeyword = preg_quote ($ cleankeyword ,'\''); $ regEx = '\'(?! (<.*?) | (] *?)>) | ([^>] *?) \'S '. $ case; $ content = preg_replace ($ regEx, $ url, $ content, $ limit); $ content = str_replace ('% & % ', stripslashes ($ ex_word), $ content) ;}return $ content ;}
This code is extracted directly from the plug-in, and there may be additional code. Currently, there is no bug in the test. In addition, after testing, it is recommended that you set $ match_num_to to 1 in the code, this is the best experience. Otherwise, the tags and links on the full screen will be dazzled. after the change to 1, it will be refreshing and simple and clean. this is my pursuit ~~