Awesome function to control youtube players in iframes
I’ve decided to convert the youtube slider I built for a client into a WP plugin. This function was a life-saver.
Read More
I’ve decided to convert the youtube slider I built for a client into a WP plugin. This function was a life-saver.
Read More
function sidebar_loginform(){
if (!(current_user_can('level_0'))){
$content = '
<form action="' . get_option( 'home' ) . '/wp-login.php" method="post">
<input type="text" name="log" id="log" value="' . wp_specialchars( stripslashes($user_login), 1 ) . '" size="20" />
<input type="password" name="pwd" id="pwd" size="20" />
<input type="submit" name="submit" value="login" class="button" />
<p>
<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label>
<input type="hidden" name="redirect_to" value="' . $_SERVER['REQUEST_URI'] . '" />
</p>
</form>';
} else {
$content = '
<a href="' . wp_logout_url( urlencode( $_SERVER['REQUEST_URI'] ) ) . '">logout</a><br />
<a href="' . get_option('home') . '/secret-page/">secret page</a>';
}
return $content;
}
function nl2br( str, is_xhtml ) {
var breakTag = ( is_xhtml || typeof is_xhtml === "undefined" ) ? "<br />" : "<br>";
return ( str + "" ).replace( /([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1"+ breakTag +"$2" );
}
A client I am building a WordPress site for wants a fixed menu, but has youtube videos in the content that overlap the menu, despite my z-index settings. Here’s how I resolved the issue.
Read More
I try and avoid plugins unless it means re-inventing the wheel, so when I needed to create a slider of content from a users youtube channel, this shortcode function came in very handy
Read More
var items = {
"foo" : 123456,
"bar" : 789012,
"baz" : 345678,
"bat" : 901234
};
for(var index in items) {
document.write( index + " : " + items[index] + "<br />");
}
/*
returns:
foo : 123456
bar : 789012
baz : 345678
bat : 901234
*/
<?php /* take away the Sticky Ability of the Post */ query_posts( 'caller_get_posts=1' ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ... /*Completely exclude Sticky posts from the Loop*/ query_posts( array( "post__not_in" => get_option( "sticky_posts" ) ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ... ?>
Querying posts where meta_key is ‘my-custom-key’ and meta_value is ‘x’ is simple enough, but what if you need to query by multiple pairs of meta data? Read on to find out how.
Read More
add_filter( 'wp_nav_menu_items', 'add_search_box', 10, 2 );
function add_search_box( $items, $args ) {
ob_start();
get_search_form();
$searchform = ob_get_contents();
ob_end_clean();
$items .= '<li>' . $searchform . '</li>';
return $items;
}
We’ve been inundated with increasingly complex requests for help with WP-e-Commerce importing, so here is a plugin to help with Category importing
Read More