Monday, January 31, 2011

Increase the number of entries in Media Library of Wordpress

Have lots of images? Don't want to paginate? Using Faster Image Inserter?

Change from 10 to whatever:

back up wp-admin/includes/media.php

find this:

$start = ( $_GET['paged'] - 1 ) * 10;
if ( $start < 1 )
$start = 0;
add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) )


and this:

$page_links = paginate_links( array(
'base' => add_query_arg( 'paged', '%#%' ),
'format' => '',
'prev_text' => __('«'),
'next_text' => __('»'),
'total' => ceil($wp_query->found_posts / 10),
'current' => $_GET['paged']
));


and change 10 to 50 or 100 or ...

Friday, January 21, 2011

MySQL fix some phone numbers

This is long and convoluted, but basically, it takes unknown inputs of phone numbers from a table:
5551212
555-1212
212555-1212
212-555-1212


and makes them all
2125551212


select Concat(if(length(PhoneNumber)< 10, "212", ""), replace(PhoneNumber, "-","")) FROM AddressBook;

update addressbook set PhoneNumber=Concat(if(length(PhoneNumber)< 10, "212", ""), replace(PhoneNumber, "-",""));

Blog Archive