Home > Development, WordPress > Remove WordPress iNove theme sidebar using custom fields

Remove WordPress iNove theme sidebar using custom fields

I’m using WordPress iNove theme v.1.4.6 and i needed a way to hide the sidebar for a specific post so i dove in the iNove theme code and figured out how to do this with the minimum changes to the original theme code.

First open the iNove theme ‘header.php’ file using your favorite editor, usually found at <wp install folder>/wp-content/themes/inove/header.php.

Now look for this piece of code (starting from the top of the file):

... some code ...
			$feed = 'http://' . $options['feed_url'];
		}
	} else {
		$feed = get_bloginfo('rss2_url');
	}
?>


Now append at the end of that code the following snippet:

<?php
    global $wp_query;
    if( get_post_custom( $wp_query->post->ID, 'nosidebar', 'true') ){
        $inove_nosidebar = true;
    }
?>

You should get some thing like this:

... some code ...
			$feed = 'http://' . $options['feed_url'];
		}
	} else {
		$feed = get_bloginfo('rss2_url');
	}
?>

<?php
    the_meta();
    global $wp_query;
    if( get_post_custom( $wp_query->post->ID, '', 'true') ){
        $inove_nosidebar = true;
    }
?>

<html xmlns="http://www.w3.org/1999/xhtml">

Now when you need to disable the sidebar in a post you simply add a new ‘Custom Field’ named ‘nosidebar’ and set it’s value to ‘true’ like you see in the figure.

Wordpress setting 'nosidebar' custom field

Et voilà, all done!

  1. March 6th, 2010 at 20:29 | #1

    Thanks a lot man, this was REALLY helpful. To think, after so much splicing and cutting and butchering, that there was such a simple solution all along! C’est la vie.

  1. No trackbacks yet.