Skip to content

Instantly share code, notes, and snippets.

View jkudish's full-sized avatar

Joey Kudish jkudish

View GitHub Profile
@jkudish
jkudish / betterimg.js
Created November 10, 2010 07:14
better image error handling w/ jquery
// Replace source
$('img').error(function(){ $(this).attr('src', 'missing.png');
}); // Or, hide them
$("img").error(function(){ $(this).hide();
});
var isMSIE = /*@cc_on!@*/0; if (isMSIE) { // do IE-specific things
} else { // do non IE-specific things
}
// will take the alt tags from all input fields and make it the default text
// default text will disappear on focus and reappear on blur if field is blank
$('input').each(function(){
if(this.alt){
this.value=this.alt;
this.onfocus=function(){if(this.value==this.alt)this.value=''}
this.onblur=function(){if(this.value=='')this.value=this.alt}
}
});
if ( have_posts() ) : while ( have_posts() ) : the_post();
wp_redirect(get_permalink());
endwhile;
endif;
<?php
/*
Template Name: Redirect To First Child
*/
if (have_posts()) {
while (have_posts()) {
the_post();
$pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order");
$firstchild = $pagekids[0];
wp_redirect(get_permalink($firstchild->ID));
function email_members($post_ID) {
global $wpdb;
$usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");
$users = implode(",", $usersarray);
mail($users, "New WordPress recipe online!", 'A new recipe have been published on http://www.wprecipes.com');
return $post_ID;
}
add_action('publish_post', 'email_members');
RewriteCond %{HTTP_HOST} !^(127\.0\.0\.0|localhost) [NC]
RewriteCond %{HTTP_USER_AGENT} .*(Firs|exac|Cloak|Detect|uchoo|beaut|ASPSeek|swish|ICS\)|MSIE\ 6\.0\;\ Windows\ NT\;\ DigExt\)|pt\-BR\;\ rv\:1\.9\.0\.3\)\ Firefox\/3\.0|pt\-BR\;\ rv\:1\.9\.0\.18\)\ Firefox\/3\.0|\!susie|\$x0e|\%0a|\%0d|\@\$x|\_irc|\_works|\+select\+|\+union\+|\&lt;\?|1\,\1\,1\,|3gse|4all|4anything|5\.1\;\ xv6875\)|59\.64\.153\.|85\.17\.|88\.0\.106\.|98|a\_browser|a1\ site|abac|abach|abby|aberja|abilon|abont|abot|accept|access|accoo|accoon|aceftp|acme|active|address|adopt|adress|advisor|agent|ahead|aihit|aipbot|alarm|albert|alek|alexa\ toolbar\;\ \(r1\ 1\.5\)|alltop|alma|alot|alpha|america\ online\ browser\ 1\.1|amfi|amfibi|anal|andit|anon|ansearch|answer|answerbus|answerchase|antivirx|apollo|appie|arach|archive|arian|aboutoil|asps|aster|atari|atlocal|atom|atrax|atrop|attrib|autoh|autohot|av\ fetch|avsearch|axod|axon|baboom|baby|back|baid|bali|bandit|barry|basichttp|batch|bdfetch|beat|become|bee|beij|betabot|biglotron|bilgi|bison|bitacle
UPDATE wp_posts SET comment_status = 'closed';
current_post + 1) < ($wp_query->post_count)) { echo '
Post Divider
';
}
?>
// remove Genesis purchase menu
remove_theme_support( 'genesis-purchase-menu' );