cyrille
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Fixing WordPress
In reply to: Allow only upload mp3, jpg, png formatSOLVED
Finally, the plugin creation is the better way to maintain the update WPSo, I write thaht and seems work fine
<?php /** * Plugin Name: Custom mime types * Plugin URI: https://crust.ovh * Description: Block upload Mime Types * Version: 1.0 * Author: crust * Author URI: http://crust.ovh **/ function custom_mime_types( $mimes ){ // Forbiden ALL unset( $mimes ); // OK 4 gif, png, jpg and mp3 only $mimes['jpg|jpeg|jpe'] = 'image/jpeg'; $mimes['gif' ] = 'image/gif'; $mimes['png'] = 'image/png'; $mimes['mp3|m4a|m4b'] = 'audio/mpeg'; // List mime types available here // https://codex.wordpress.org/Function_Reference/get_allowed_mime_types return $mimes; } add_filter('upload_mimes', 'custom_mime_types', 1, 1); ?>Forum: Fixing WordPress
In reply to: Allow only upload mp3, jpg, png formatOK thx for your answer
I’ll patch the function.php file so.In order to automatized the update, I’ll write a diff script to update this file when an WP update appears
A diff based on would works fine
cat version.php | grep 'wp_version =' $wp_version = '5.2.2';For the function to add, I found that on the web
function custom_mime_types( $mimes ){ // Authorzied SVG $mimes['svg'] = 'image/svg+xml'; // Forbid PDF unset( $mimes['pdf'] ); return $mimes; } add_filter('upload_mimes', 'custom_mime_types', 1, 1);Is not better to forbiden all mimes types before and only authorized after
Do you think, It’s good ?function custom_mime_types( $mimes ){ // Forbiden ALL unset( $mimes ); // OK 4 svg, jpg and mp3 only $mimes['svg'] = 'image/svg+xml'; $mimes['jpg'] = 'image/jpeg, image/pjpeg $mimes['jpeg'] = 'image/jpeg, image/pjpeg $mimes['png'] = 'image/png $mimes['mp3] = 'audio/mpeg3, audio/x-mpeg-3, video/mpeg, video/x-mpeg '; return $mimes; } add_filter('upload_mimes', 'custom_mime_types', 1, 1);Do you think is correct ?
Forum: Plugins
In reply to: WP-dTree-3 : display a tree in a static pageOK this works well:
<?php $args = array('name'=>'top_sidebar', 'before_widget' => '<li style="list-style-type: none; list-style-image: none>"', 'after_widget' => '</li>', 'before_title' => '<span><strong>', 'after_title' => '</strong></span><br />' ); ?> <table class="optiontable" width="80%"> <tr class="alternate"> <th>Categories widget</th> <th>Pages widget</th> </tr> <tr> <td style="vertical-align:top;margin-top:0;" width="25%"><?php widget_wp_dtree_get_categories($args);?></td> <td style="vertical-align:top;margin-top:0;" width="25%"><?php widget_wp_dtree_get_pages($args);?></td> </tr> <tr class="alternate"> <th>Links widget</th> <th>Archive widget</th> </tr> <tr> <td style="vertical-align:top;margin-top:0;" width="25%"><?php widget_wp_dtree_get_links($args);?></td> <td style="vertical-align:top;margin-top:0;" width="25%"><?php widget_wp_dtree_get_archives($args);?></td> </tr> </table>RESOLVED
Viewing 3 replies - 1 through 3 (of 3 total)