Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

stiwdio on "Code Hack"

$
0
0

Hi Guys

I have a theme Im working on, heres the code for the single post category;

if ( have_posts() ) {
	while ( have_posts() ) {
		the_post();
		//get all the page data needed and set it to an object that can be used in other files
		$pexeto_page=array();
		$pexeto_page['sidebar']=( 'Blog' );
		$pexeto_page['slider']='none';
		$pexeto_page['layout']=pexeto_option( 'post_layout' );

		//include the before content template
		locate_template( array( 'includes/html-before-content.php' ), true, true );

		$pexeto_page['sidebar']=( 'Play' );

		//include the post template
		locate_template( array( 'includes/post-template.php' ), true, false );

		//include the comments template
		comments_template();
	}
}

Where it defines what sidebar to use
$pexeto_page['sidebar']=( 'Play' );

Would it be possible for it to check the category of the post and if, for instance the category ID is 12 then $pexeto_page['sidebar']=( 'Play' ); otherwise use

$pexeto_page['sidebar']=( 'Another Sidebar' );

Would anyone know if this is possible and how to format it?

Thanks for your help
Darren


Viewing all articles
Browse latest Browse all 8245

Trending Articles