Youtube channel shortcode
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
<?php // Disable PHP Timeout example // http://php.snippetdb.com //set php script timeout, 0 to disable set_time_limit(0); // your time consuming code //don't forget to reset to 30 seconds. set_time_limit(30); ?>
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;
}
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
<?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 built a custom search page by writing our own post query, but we needed to apply pagination. Here’s how we did it…
Read More
There are plenty of functions floating about for limiting the length of a WordPress post title, but what if your title contains single quotes?
Read More
We’ve covered bulk uploading in WP eCommerce previously, but what if you want to bulk update?
Read More
The latest version of wpec handles csv uploads differently – time for an update!
Read More