博文

目前显示的是标签为“WordPress”的博文

[WP Plugin] Geek Mail Whitelist

图片
WordPress sites administrators often encounter a problem - zombie or fake users register to your site using fake Emails. The emails they use often strictly follow the Email format so it's hard for our program to judge if they are valid or not. Although we can prevent these users from really using our sites by sending activation Email, still they are a waste of database space and make it harder to manage members. As a result, an Email whitelist is needed to filter these annoying registrations. Geek Mail Whitelist is a plugin which can allow users with certain emails to register to your WordPress site by adding whitelist rules. What's more, it supports regular expression rules which makes it more powerful to fit all kinds of situations. And it is COMPLETELY FREE! Github page: https://github.com/gongwan33/geek-mail-whitelist Description - Allow certain kinds of users to register to your WordPress site by adding mail whitelist rules. - Super simple to use...

[WP Plugin] Geek Mail Blacklist

图片
WordPress sites administrators often encounter a problem - zombie or fake users register to your site using fake Emails. The emails they use often strictly follow the Email format so it's hard for our program to judge if they are valid or not. Although we can prevent these users from really using our sites by sending activation Email, still they are a waste of database space and make it harder to manage members. As a result, an Email blacklist is needed to filter these annoying registrations. Geek Mail Blacklist is a plugin which can block users with certain emails from registering to your WordPress site by adding blacklist rules. What's more, it supports regular expression rules which makes it more powerful to fit all kinds of situations. And it is COMPLETELY FREE! Github page: https://github.com/gongwan33/geek-Mail-Blacklist WordPress Official page:  https://wordpress.org/plugins/geek-mail-blacklist/ Description - Block certain kinds of users from re...

[WordPress]What the F***! the parent theme is missing?!

There is a very wired problem. I created a child theme named Fatsom Child and I set 'Template: Fatsom' in style.css and the parent theme is Fatsom which had been already installed. It worked perfectly in my local environment. The child theme could be successfully detected by WordPress and activated manually. But, when I uploaded the parent theme and child theme to  my host, a very strange thing happened: In my backend, WordPress threw an error saying "the parent theme 'Fatsom' is missing"! And I could not find 'Fatsom Child' to activate! Why! I was blocked by this problem the whole evening. Finally, I found the solution -- just change 'Template: Fatsom' to 'Template: fatsom' in style.css of the child theme and it works again! I couldn't tell why, but it just happened. If you knows why or encountered the same problem, please comment this blog or email me (wagner@joybin.cn). Have a good day!

[WordPress]Oops, customized query vars make front page missing

There is a very strange thing which may be a bug but not fixed yet in WordPress -- If you add a customized query var, it will make the WordPress lost the static front page and directly point to the post river. (As discussed in https://core.trac.wordpress.org/ticket/25143#comment:36 ) For example, if our static front page is http://www.example.com/ and we add following code to add a query var named 'lang' hoping that we could get 'lang' from the structure of http://www.example.com/%lang% function add_custom_page_variables ( $ public_query_vars ) {         $ public_query_vars [] = ' lang ';         return $ public_query_vars ;     } add_filter ( ' query_vars ', array ( $ this , ' add_custom_page_variables ' ) ) ; It doesn't work. get_query_var will return null and what is worse, the front page will lost if we use http://www.example.com/en. Actually, current parse_query will check $_query after it thinks it is a ho...

[WordPress] About the URL autocompletion function in WordPress

There is an unimpressive URL autocompletion function in WordPress which a lot of the users or developers may not know. This function can find the most similar URL even if the URL input is not exactly right. For example: there is a permalink http://www.example.com/testpost If you mistakenly input http://www.example.com/testp, the WordPress can still help you find the testpost. This sounds nice. But it can cause some problems. For example, I want to add a rewrite rule to make http://www.example.com/en point to http://www.example.com/?lang=en. This autocompletion function will still try to find something similar to 'en' instead of giving me the page of http://www.example.com directly. So we have to turn off this function. Here is the solution: add_action ( ' redirect_canonical ', ' __return_false ' ) ; After adding this action, this autocompletion function will be turned off and the rewrite rules will successfully work.

[WordPress API] About the 'count' field of get_terms function

get_terms is a very common function in WordPress. Here is the definition: get_terms(  array|string   $args  =  array() ,   array   $deprecated  =  ''  ) For example: $res = get_terms(term->taxonomy, array('parent' => term->id, 'hide_empty' => false)); var_dump($res); The WordPress will print something like this: array (size=5) 0 => object ( WP_Term )[ 4319 ] public 'term_id' => int 15 public 'name' => string 'Copenhagen S' (length=12) public 'slug' => string 'copenhagen-s' (length=12) public 'term_group' => int 0 public 'term_taxonomy_id' => int 15 public 'taxonomy' => string 'property_city' (length=13) public 'description' => string '' (length=0) public 'parent' => int 37 public 'count' => int 3 public...

[WordPress Plugin] Translator with Baidu Service -- a good alternative to GTranslate to avoid GFW problem

If some of your WordPress site's users are in mainland China, you may need a plugin to translate your site into Chinese. One of the most popular translating plugin is GTranslate which is based on the Google translating service. But the problem is people in mainland China can not access Google. As a result, GTranslate cannot work in mainland China, only if using the VPN -- it's not quiet possible for a potential visitor to buy a VPN account.  Translator with Baidu Service is a similar plugin which is based on Baidu translating service. As Baidu is a big Chinese company, its translating service can be accessed from mainland China. Moreover, because Baidu deploys its servers all over the world,  people can use its services wherever they are.  Baidu translating service is very good at translating different languages into Chinese. Currently Translator with Baidu Service supports 25 languages: Chinese, English, Japanese, Korean, French, Spanish, Thai, Arabic, Russian, Po...