Calculadora 2.5

Licencia 499€/Mes Licencia 6.000€ Licencia 9.500€ Licencia 49.000€ Ganancia NETA: Duración de la inversión:  El “Interés Compuesto” representa una de las estrategias financieras más potentes disponibles. Se trata de un sistema en el cual las ganancias derivadas de una inversión…Continue reading

Kupon kódok megjelenítése az értesítő email-ekben

add_action( ‘woocommerce_email_order_meta’, function( $order, $sent_to_admin, $plain_text, $email ) { // Check if coupon is used in order if ( $order->get_used_coupons() ) { // Get the coupon codes used in the order $coupon_codes = implode( ‘, ‘, $order->get_used_coupons() ); // Set…Continue reading

Explicit Fixed Width and Height

add_filter( ‘the_content’, ‘add_image_dimensions’ ); function add_image_dimensions( $content ) { preg_match_all( ‘/]+>/i’, $content, $images); if (count($images) < 1) return $content; foreach ($images[0] as $image) { preg_match_all( '/(alt|title|src|width|class|id|height)=("[^"]*")/i', $image, $img ); if ( !in_array( 'src', $img[1] ) ) continue; if ( !in_array(…Continue reading

Get YouTube ID

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

Get YouTube API

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

Limit user files in media library

function limit_media_files($file) { // Get the current user ID $current_user_id = get_current_user_id(); // Query media files for the current user $media_files = new WP_Query(array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ‘author’ => $current_user_id )); // Check if…Continue reading

Count and message according to number of user files

function count_user_media_files() { // Check if the current page is the media library $screen = get_current_screen(); if ($screen->id !== ‘upload’) { return; } // Get the current user ID $current_user_id = get_current_user_id(); // Query media files for the current user…Continue reading

change media owner

// Add a custom column in the Media Library list view function custom_media_columns($columns) { // Check if the current user is an administrator if (current_user_can(‘manage_options’)) { $columns[‘change_author’] = ‘Author’; } return $columns; } add_filter(‘manage_media_columns’, ‘custom_media_columns’); // Display the ‘Change Author’…Continue reading