Last active
November 9, 2016 13:18
-
-
Save yahilmadakiya/b25d331e53159a877da7140f05fe4dc0 to your computer and use it in GitHub Desktop.
Allows to upload particular filetypes in particular page using rtmedia_uploader source code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rtmedia_media_uploader_attributes_shortcode( $attr ) { | |
global $rtmedia; | |
$allowed_media_type = $rtmedia->allowed_types; | |
/* page id */ | |
$page_id = '95'; | |
/* File extension */ | |
$extn = 'doc'; | |
if ( get_the_ID() == $page_id ) { | |
$extn = explode( ',', $extn ); | |
if ( isset( $attr['media_type'] ) ) { | |
if ( isset( $allowed_media_type[ $attr['media_type'] ] ) ) { | |
$allowed_media_type[ $attr['media_type'] ]['extn'] = $extn; | |
wp_localize_script( 'rtmedia-backbone', 'rtmedia_upload_type_filter', $allowed_media_type[ $attr['media_type'] ]['extn'] ); | |
} | |
} | |
} | |
return $attr; | |
} | |
add_filter( 'rtmedia_media_uploader_attributes', 'rtmedia_media_uploader_attributes_shortcode', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment