This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.
— Erik
<?php | |
/** | |
* Make sure the function does not exist before defining it | |
*/ | |
if( ! function_exists( 'remove_class_filter' ) ){ | |
/** | |
* Remove Class Filter Without Access to Class Object | |
* | |
* In order to use the core WordPress remove_filter() on a filter added with the callback |
<?php | |
/** | |
* Return an ID of an attachment by searching the database with the file URL. | |
* | |
* First checks to see if the $url is pointing to a file that exists in | |
* the wp-content directory. If so, then we search the database for a | |
* partial match consisting of the remaining path AFTER the wp-content | |
* directory. Finally, if a match is found the attachment ID will be | |
* returned. | |
* |
function autoset_featuredimage() { | |
global $post; | |
$already_has_thumb = has_post_thumbnail($post->ID); | |
if (!$already_has_thumb) { | |
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" ); | |
if ($attached_image) { | |
foreach ($attached_image as $attachment_id => $attachment) { | |
set_post_thumbnail($post->ID, $attachment_id); | |
} | |
} |