Twitter Nonsense

Twitter Nonsense Screenshot

Twitter Nonsense is new addition to my portfolio. Its a beautiful and nice use of wordpress to present daily-comic strips. I was responsible for implementing the design into the wordpress theme with some necessary customization to wordpress itself. The client for this project is Anton Gigov, one of the best clients I’ve been working with.

The difficult part was to show comments and commet-form on home page. It is possible with a hack: by commenting out line # 643 in wp-includes/comment-template.php:

642. if ( ! (is_single() || is_page() || $withcomments) )
643.         return;

But modifying wordpress core files is never a good option if you can achieve the results with a plugin or custom coding within theme. What I did for Twitter Nonsense was to write the following code segment at the top of header.php that redirects the user to latest-post when he visits the site:

$url = “http://” . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’];

if($url == ‘http://www.pink-sheep.com/twitter-nonsense/’)
{
global $wpdb;
$last_post_id = $wpdb->get_var( “SELECT ID FROM $wpdb->posts WHERE post_type = ‘post’ AND post_password = ” AND post_status = ‘publish’ ORDER BY post_date DESC LIMIT 1″);
wp_redirect( get_permalink( $last_post_id ) );
exit;
}

0 Comments

Add Yours →

Leave a Reply

Your email address will not be published. Required fields are marked *