This file contains 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
<? php | |
//syntax: | |
wp_editor( $content, $editor_id, $settings = array() ); | |
// default settings | |
$settings = array( | |
'wpautop' => true, // use wpautop? | |
'media_buttons' => true, // show insert/upload button(s) | |
'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here | |
'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..." |
This file contains 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
<? php | |
$post_mime_type = ( 'audio/mpeg' == get_post_mime_type( $post ) ) ? 1 : 0; | |
if( 1 == $post_mime_type ) { | |
$form_fields[...] = array(...); | |
} | |
?> |
This file contains 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
<a href="media-upload.php?type=image&TB_iframe=true" class="thickbox" title="Select A Banner Image From Gallery" onclick="return false;" class="thickbox"> | |
<img id="banner_image" src="<?php echo(htmlentities($banner_image)); ?>" width="450" height="25" /> | |
</a> | |
<input type="hidden" id="banner_image_input" name="banner_image" value="<?php echo(htmlentities($banner_image)); ?>" /> | |
<?php | |
/* | |
strip out everything but the image source and updates the form. First, the function eliminates all of the text returned except the image source. It then updates the banner image and the hidden input value that I am using in my form: | |
*/ | |
function send_to_editor(html) { |
This file contains 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
<?php | |
// add a tab | |
function modify_post_mime_types($post_mime_types) { | |
$post_mime_types['application/x-shockwave-flash'] = array('Flash', 'Manage Flash', 'Flash (%s)'); | |
return $post_mime_types; | |
} | |
add_filter('post_mime_types', 'modify_post_mime_types'); | |
//remove a tab by its type |
This file contains 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
<?php | |
//http://shibashake.com/wordpress-theme/expand-the-wordpress-media-library-admin-panel | |
add_action('admin_init', 'init_media_plus'); | |
function init_media_plus() { | |
// Only activate plugin for the Media Library page | |
if (strpos($_SERVER["REQUEST_URI"], "upload.php") === FALSE) | |
return; | |
This file contains 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
http://shibashake.com/wordpress-theme/find-posts-dialog-box | |
<?php | |
?> | |
<form name="plugin_form" id="plugin_form" method="post" action=""> | |
<?php wp_nonce_field('plugin_nonce'); ?> | |
// Other form elements and code ... | |
<?php find_posts_div(); ?> | |
</form> | |
<?php |
This file contains 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
<?php | |
add_action( 'admin_footer', 'file_gallery_check_attachment_originality' )); | |
function press_gallery_check_attachment_originality() { | |
$find_screen = - 1; | |
if (is_admin ()) { | |
$find_screen = ('upload' == get_current_screen ()->base) ? 1 : 0; | |
} else { | |
$find_screen = ('create' == xxx_view () || 'edit' == xxx_view ()) ? 1 : 0; | |
} |
This file contains 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
<?php | |
function media_gallery_content() { | |
global $post; | |
echo '<div id="fg_container"> | |
<noscript> | |
<div class="error" style="margin: 0;"> | |
<p>' . __ ( 'File Gallery requires Javascript to function. Please enable it in your browser.', 'file-gallery' ) . '</p> | |
</div> | |
</noscript> |
This file contains 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 get_attachment_icons($echo = false){ | |
$sAttachmentString = "<div class='documentIconsWrapper'> \n"; | |
if ( $files = get_children(array( //do only if there are attachments of these qualifications | |
'post_parent' => get_the_ID(), | |
'post_type' => 'attachment', | |
'numberposts' => -1, | |
'post_mime_type' => 'application/pdf', //MIME Type condition | |
))){ | |
foreach( $files as $file ){ //setup array for more than one file attachment | |
$file_link = wp_get_attachment_url($file->ID); //get the url for linkage |
This file contains 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
// Registers our function to filter default gallery shortcode | |
remove_shortcode('gallery'); | |
add_shortcode('gallery', 'sandbox_gallery'); | |
// Function to filter the default gallery shortcode | |
function sandbox_gallery($attr) { | |
global $post; | |
static $instance = 0; | |
$instance++; |