// Register the smart tag. add_filter( ‘wpforms_smart_tags’, static function( $tags ) { // Key is the tag, value is the tag name. $tags[‘current_unix_time’] = ‘Current Unix Time’; return $tags; } ); // Replace its value on form render on front-end.…Continue reading
function pw_edd_custom_countries( $countries = array() ) { $countries = array( ‘US’ => ‘United States’, ‘CA’ => ‘Canada’ ); return $countries; } add_filter( ‘edd_countries’, ‘pw_edd_custom_countries’ );Continue reading
add_action( ‘customize_register’, ‘__return_true’ );Continue reading
function theme_get_video_id($url=”){ $url_parts = array(); $video_id = ”; if(!empty($url) && is_string($url)){ if(strpos($url,’youtube.be’) !== false){ $url_parts = explode(‘be/’,$url); }elseif(strpos($url,’?v=’) !== false){ $url_parts = explode(‘?v=’,$url); }elseif(strpos($url,’/v/’) !== false){ $url_parts = explode(‘/v/’,$url); }elseif(strpos($url,’/shorts/’) !== false){ $url_parts = explode(‘/shorts/’,$url); } if(isset($url_parts[0]) && isset($url_parts[1])){ if(strpos($url_parts[1],’?’)…Continue reading
function theme_youtube_api($media){ $ids = array(); foreach($media as $m){$ids[] = theme_get_video_id(get_field(‘video_url’,$m->ID));} $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,”https://www.googleapis.com/youtube/v3/videos?part=contentDetails,statistics&id=”.implode(‘,’,$ids).’&key=’.YOUTUBE_APIKEY); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_HEADER,0); $output = curl_exec($ch); curl_close($ch); $json = json_decode($output); $info = array(); foreach($json->items as $v){ $o = new stdClass(); $duration = str_replace(array(‘PT’,’H’,’M’,’S’),array(”,’:’,’:’,”),$v->contentDetails->duration); $duration_parts = explode(‘:’,$duration); $pad_parts…Continue reading
function disable_all_notifications() { wp_deregister_script(‘wp-notification-script’); } add_action(‘wp_enqueue_scripts’, ‘disable_all_notifications’, 999);Continue reading
/** * Reusable Blocks accessible in backend * */ function be_reusable_blocks_admin_menu() { add_menu_page( ‘Reusable Blocks’, ‘Reusable Blocks’, ‘edit_posts’, ‘edit.php?post_type=wp_block’, ”, ‘dashicons-editor-table’, 22 ); } add_action( ‘admin_menu’, ‘be_reusable_blocks_admin_menu’ );Continue reading
function change_lost_your_password ($text) { if ($text == ‘Lost your password?’){ $text = ‘Reset/Forgot Password?’; } return $text; } add_filter( ‘gettext’, ‘change_lost_your_password’ );Continue reading
add_filter( ‘graphql_connection_max_query_amount’, function ( int $max_amount, $source, array $args, $context, $info ) { // Bail if the fieldName isn’t avail if ( empty( $info->fieldName ) ) { return $max_amount; } // Bail if we’re not dealing with our target fieldName…Continue reading