Display Full Content Per Category

By the default, the Genesis child theme called Outreach Pro displays categories posts as excerpts. If you want to display the full content on just one category, Sridhar Katakam talks about it in his blog post. I changed the function names to fit my own, so here’s my own version of the code:

// display full content on blog category
add_action( 'genesis_before_loop', 'urr_full_content_specific_category' );
 
function urr_full_content_specific_category() {
  if (is_category('blog')) {
		remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
		add_action( 'genesis_entry_content', 'urr_do_post_content' );
	}
}
function urr_do_post_content() {
	the_content();
}

Display Post From A Year Ago

Here’s a cool little WordPress script to display a post from a year ago. You can display your old content to entice your readers to view older articles. You can display your old posts on your theme’s sidebar, after your post content, or just anywhere on your theme. Here’s the code.

// current day of the month without leading zeros, e.g. 1-31.
$current_day = date('j');
// last year
$last_year = date('Y')-1;
// perform a query based on today's date last year
query_posts('day='.$current_day.'&year='.$last_year);
if (have_posts()):
    while (have_posts()) : the_post();
       the_title();
       the_excerpt();
    endwhile;
endif;

The result will depend if you have a post last year on the exact date as today, otherwise you’ll get a blank result. I suppose to be on the safe side, you can query all posts of the current month last year. Your chances of getting results is much better. You can use the date(‘n’) function to extract the current month. Your query would look something like this:

$current_month = date('n');
query_posts('month='.$current_month.'&year='.$last_year);

Hide WordPress Admin Bar

There are reasons why you want to hide the Admin Bar from your users. If users don’t have edit rights, then there’s really no use for an Admin bar. Another reason is if the account is shared with others, you don’t want users to reset the password. There are ample reasons why you want to hide the Admin bar.

Here’s the code:

if (!current_user_can(‘edit_posts’)) {
  show_admin_bar(false);
}

Here’s another:

function my_function_admin_bar(){ return false; }
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

Here’s another for users that can’t manage options:

if ( ! current_user_can( 'manage_options' ) ) {
  show_admin_bar( false );
}

And one more for good measure:

add_action('set_current_user', 'csstricks_hide_admin_bar');
function csstricks_hide_admin_bar() {
  if (current_user_can('edit_posts')) {
    show_admin_bar(false);
  }
}

HTML5 Fullscreen Background Videos

I noticed several websites using a fullscreen background videos on their home pages. A good example is Paypal.com. The videos are typically short, between 10-15 seconds, with the sound turned off. The video falls back to a still background image for visitors whose browsers do not support HTML5 videos.

In addition, Paypal is using what looks like a playlist of several short videos that are displayed in a loop. If you’re interested in how you can implement background videos on your web pages, demothenes.info has a tutorial on how to add video background videos on your website.

Shades of Color

Part of creating web design involves working with shades of color. At times, using a color for a HTML link may look good indeed, but the same Hex color code may not necessarily work as a background color. As a designer, you may have to work with different shades of the same color.

This article, the code side of color, explains the science behind hexadecimal code, but if you need to figure out colors quickly on your website, Colllor is a great resource that I have been using for several years. Check it out.