^([\s]{2,})(?!.*[&@])(.*?)([,{])\n
$1& $2$3\n
| <?PHP | |
| function get_token($length = 32) { | |
| if ( ! isset($length) || intval($length) <= 8 ) { | |
| $length = 32; | |
| } | |
| // PHP 7.0+ | |
| if ( function_exists('random_bytes') ) { | |
| return bin2hex(random_bytes($length)); | |
| } | |
| // PHP 5.3+ |
| <?php | |
| function array_remove_empty( $array ) { | |
| foreach ( $array as $key => $value ) { | |
| if ( is_array($value) ) { | |
| $array[$key] = array_remove_empty( $array[$key] ); | |
| } | |
| if ( empty( $array[$key] ) ) { | |
| unset( $array[$key] ); | |
| } |
| <?php | |
| function get_the_terms_deepest($taxonomies, $term_order = false) { | |
| $categories = get_the_terms(get_the_ID(), $taxonomies); // get all product cats for the current post | |
| if($categories && !is_wp_error($categories)){ // wrapper to hide any errors from top level categories or products without category | |
| if(count($categories) == 1){ // Case: Select only Category of Top Level. (Required: Activate Plugin Parent Category Toggler) | |
| $return = $categories; | |
| }elseif(count($categories) > 1){ | |
| $return = array(); | |
| foreach($categories as $category){ // loop through each cat | |
| $children = get_categories(array('taxonomy' => $taxonomies, 'parent' => $category->term_id)); // get the children (if any) of the current cat |
| <?php | |
| /** | |
| * Add new user column: Expire Date. | |
| * | |
| * @since 1.0.0 | |
| * @return array $columns | |
| */ | |
| function prefix_expire_date_column( $columns ) { | |
| $columns['expire_date'] = __( 'Expire Date', 'text-domain' ); | |
| return $columns; |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.2.43/jquery.form-validator.min.js"></script> | |
| <script> | |
| var japanese = { | |
| errorTitle: 'フォームの送信に失敗しました', | |
| requiredFields: 'すべての必須フィールドに答えていません', | |
| badTime: '時間が正しくありません', | |
| badEmail: 'メールアドレスが正しくありません', | |
| badTelephone: '電話番号が正しくありません', | |
| badSecurityAnswer: 'セキュリティの質問の答えが正しくありません', |
| <?php | |
| function is_single_paged($page){ | |
| global $wp_query; | |
| if(!is_preview()){ | |
| $paged = (get_query_var('page')) ? get_query_var('page') : 1; | |
| }else{ | |
| $pagenum = $_GET['paged']; | |
| $paged = ($pagenum) ? $pagenum : 1; | |
| $wp_query->query = array('p' => $post->ID, 'page' => $paged, 'preview' => true, 'post_type' => get_post_type() ); | |
| $wp_query->set('paged', $paged); |
| <?php | |
| function remove_administrator($users) | |
| { | |
| foreach ($users as $key => $user) { | |
| $cap = reset($user->roles); | |
| if ($cap === 'administrator') { | |
| unset($users[$key]); | |
| } | |
| } | |
| return $users; |
| <?php | |
| /*================================================== | |
| "get_the_terms" to the order of the "term_order". (order by ASC.) | |
| ================================================== */ | |
| function get_the_terms_orderby_termorder($taxonomy){ | |
| global $post; | |
| $terms = get_the_terms($post->ID, $taxonomy); | |
| $array = array(); | |
| foreach($terms as $term){ | |
| $array[$term->term_order] = (object)array( |