leup
Forum Replies Created
-
My function looks like this :
function custom_field_template_admin_scripts() { if ( !defined('WP_PLUGIN_DIR') ) $plugin_dir = str_replace( ABSPATH, '', dirname(__FILE__) ); else $plugin_dir = dirname( plugin_basename(__FILE__) ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-form' ); wp_enqueue_script( 'date', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/date.js', array('jquery') ); wp_enqueue_script( 'bgiframe', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.bgiframe.js', array('jquery') ) ; wp_enqueue_script( 'datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.datePicker.js', array('jquery') ); wp_enqueue_script( 'textarearesizer', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.textarearesizer.js', array('jquery') ); if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || (isset($post) && $post->post_type=='page') ) : wp_enqueue_script( 'editor' ); ////////////////////////////// //PATCH leup add_thickbox(); wp_enqueue_script('media-upload'); wp_enqueue_script('jquery-metadata','https://view.jquery.com/trunk/plugins/metadata/jquery.metadata.js',array('jquery'),false,true); ////////////////////////////// endif; }
(before or after the last endif is mostly the same. If you put the 3 lines before the last endif allow us to load these scripts only if we are on a edit page…)
With these lines, the media window pops up in a thickbox instead of opening in a new page.
Well, it works for me.
Forum: Plugins
In reply to: [Plugin: Custom Field Template] Embedding FlashHi,
What i did to embed flash files (swf, not flv) but i think you could do the same with another plugin for FLV.
i use SWFObj plugin to embed flash objects in my posts.
I have a custom post type named ‘produit’. I made a custom template for it with the following field to upload file :
[VCarrousel] type = file mediaPicker = true mediaLibrary = true alias = Visuel carrousel
I create a single-produit.php to display my ‘produit’ posts where i wrote in these lines :
<?php //give me the attachement id $idvc = do_shortcode('[cft key=VCarrousel]'); //if it's an image, display it in 160x160 if (wp_attachment_is_image($idvc)) { echo wp_get_attachment_image($idvc , 'attachment-160x160' ) ; } else { //check if it's a flash file from the mime type if (preg_match('@(shockwave|flash)@i',get_post_mime_type($idvc))) { echo do_shortcode('[swfobj src="'. wp_get_attachment_url($idvc) . '" dynamic_embed="true" play="false"]'); } } ?>
I think you could use the Flash Video Player plugin instead of SWFObj and modify the above code to match the fvp shortcode.
Good luck !
Forum: Plugins
In reply to: [Custom Field Template] [Plugin: Custom Field Template] Full DocumentationDocumentation would be great ! Examples would be perfect ^^
Hi !
What i did to workaround the need to enable ‘editor’ is adding these lines at the end of function ‘custom_field_template_admin_scripts‘ in file ‘custom-filed-template.php‘ (the plugin core file) :
add_thickbox(); wp_enqueue_script('media-upload'); wp_enqueue_script('jquery-metadata','https://view.jquery.com/trunk/plugins/metadata/jquery.metadata.js',array('jquery'),false,true);