Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php code for svg support wordpress

// Wp v4.7.1 and higher --- python-tagline
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
  $filetype = wp_check_filetype( $filename, $mimes );
  return [
      'ext'             => $filetype['ext'],
      'type'            => $filetype['type'],
      'proper_filename' => $data['proper_filename']
  ];

}, 10, 4 );

function cc_mime_types( $mimes ){
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );

function fix_svg() {
  echo '<style type="text/css">
        .attachment-266x266, .thumbnail img {
             width: 100% !important;
             height: auto !important;
        }
        </style>';
}
add_action( 'admin_head', 'fix_svg' );
Comment

Wordpress SVG Manually - function.php

// Enable SVG support
function add_mime_types($mimes) {
	$mimes['svg'] = 'image/svg+xml';
	return $mimes;
}
add_filter('upload_mimes', 'add_mime_types');
Comment

PREVIOUS NEXT
Code Example
Php :: destroy php variable 
Php :: login with email or phone number laravel 
Php :: php number format 2 decimal no comma 
Php :: créer projet laravel 
Php :: php datetime to mysql 
Php :: php post curl json 
Php :: php explode 
Php :: php mysqli number row 
Php :: cart icon in woocommerce 
Php :: display summernonte data with string limit laravel 
Php :: get parameter in php 
Php :: the requested php extension ext-intl * is missing from your system ubuntu 
Php :: wordpress wpdb 
Php :: types of looping directives in laravel 
Php :: memory limit wordpress 
Php :: add csrf token laravel 
Php :: email php using html 
Php :: php get file type from url 
Php :: write file in php 
Php :: how to get time php with am/pm 
Php :: php unique string 
Php :: spatie media library retrieve media from url 
Php :: remove all spaces php 
Php :: laravel where has 
Php :: get current year php 
Php :: laravel excel set cell height 
Php :: laravel wherehas 
Php :: if any error in blade laravel 
Php :: seconds to days hours minutes seconds php 
Php :: carbon finer 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =