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 remove_menu_pages() { | |
remove_menu_page('link-manager.php'); | |
remove_menu_page('edit-comments.php'); | |
} | |
add_action( 'admin_init', 'remove_menu_pages' ); | |
// http://www.netmagazine.com/tutorials/customise-wordpress-admin-area |
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
// edit fields in media upload area | |
add_filter('attachment_fields_to_edit', 'remove_media_upload_fields', 10000, 2); | |
function remove_media_upload_fields( $form_fields, $post ) { | |
// remove unnecessary fields | |
unset( $form_fields['image-size'] ); | |
unset( $form_fields['post_excerpt'] ); | |
unset( $form_fields['post_content'] ); | |
unset( $form_fields['url'] ); | |
unset( $form_fields['image_url'] ); |
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
// size calculation | |
$docsize = @filesize( get_attached_file ( $attachment->ID ) ); | |
// show the attachment, | |
echo $filename . ' — ' . $docsize; | |
// echoes something like attachment.zip — 13143 | |
// use size_format() instead. start with size calculation | |
$docsize = @filesize( get_attached_file( $attachment->ID ) ); | |
if (FALSE === $docsize) |
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
<div class="upload_field" | |
<input type="text" name="upload_one" id="upload_one" class="upload" value="" /> | |
<input type="button" class="upload-button" value="Upload Image" /> | |
</div> | |
<div class="upload_field" | |
<input type="text" name="upload_two" id="upload_two" class="upload" value="" /> | |
<input type="button" class="upload-button" value="Upload Image" /> | |
</div> |
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
wp_oembed_add_provider( '#http://(www\.)?youtube.com/watch.*#i', 'http://www.youtube.com/oembed?iframe=1', true ); |
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
// remove all shortcodes | |
add_filter('the_content', 'strip_shortcodes'); | |
// remove specific shortcode | |
remove_shortcode('gallery'); |
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
$myvalue = 'Test me more'; | |
$arr = explode(' ',trim($myvalue)); | |
echo $arr[0]; // will print Test |
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
while ( have_posts() ) : the_post(); | |
if( $wp_query->current_post ==0 && !is_paged() ) { | |
$myclass = "fist-post"; | |
} | |
endwhile; |
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
add_filter("manage_upload_columns", 'upload_columns'); | |
add_action("manage_media_custom_column", 'media_custom_columns', 0, 2); | |
function upload_columns($columns) { | |
unset($columns['parent']); | |
$columns['better_parent'] = "Parent"; | |
return $columns; |
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
$attachments = get_children ( | |
array ( | |
'post_parent' => get_the_ID(), | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image' | |
) | |
); | |
if ( $attachments ) { | |
// do conditional stuff here |