How to enable/disable a hook with theme options

Actually all I had to do is, run theme options inside the function, like this: function mytheme_under_construction(){ global $mytheme; if(!empty($mytheme[‘offline_id’])){ // if user is logged in, don’t show the construction page if ( is_user_logged_in() ) { return; } $protocol = $_SERVER[“SERVER_PROTOCOL”]; if ( ‘HTTP/1.1’ != $protocol && ‘HTTP/1.0’ != $protocol ) $protocol=”HTTP/1.0″; // 503 is … Read more

Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)

Add minimum word count to Excerpt field To enforce a minimum word count for the Excerpt field before the Post status can be changed to pending, we will slightly alter s_ha_dum‘s code. It can be done by filtering wp_insert_post_data: function wcexcerpt($data){ if (!current_user_can(‘edit_others_posts’)) { $num = 5; // minimum word count if (str_word_count($data[‘post_excerpt’]) < $num) … Read more