• Resolved fuxiadmin

    (@fuxiadmin)


    Hello

    I’m attempting to give my single.php two options

    The second option is divided into two columns (widgets). I thought below would be the code to use but it is not working. Could somebody tell me what’s wrong with it?

    <?php get_header(); ?>
    
    <div id="bigcolumn">
    
    <?php
    $post = $wp_query->post;
    if ( in_category('45') ) {
    include (TEMPLATEPATH . '/widgets/single2.html');
    } else {
    <div id="singleleftcolumn"><?php $sec = 1; include TEMPLATEPATH. '/widgets/leftmenu.html'; ?></div>
    <div id="singlerightcolumn"><?php $sec = 2; include TEMPLATEPATH. '/widgets/single.html'; ?></div>
    }
    ?>
    
    <div class="clear"></div>
    </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just need to add the PHP tags in the relevant places, try this..

    <?php get_header(); ?>
    
    <div id="bigcolumn">
    
    	<?php
    	$post = $wp_query->post;
    	if ( in_category('45') ) :
    		include (TEMPLATEPATH . '/widgets/single2.html');
    	else :
    	?>
    		<div id="singleleftcolumn"><?php $sec = 1; include TEMPLATEPATH. '/widgets/leftmenu.html'; ?></div>
    		<div id="singlerightcolumn"><?php $sec = 2; include TEMPLATEPATH. '/widgets/single.html'; ?></div>
    	<?php
    	endif;
    	?>
    
    	<div class="clear"></div>
    </div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thread Starter fuxiadmin

    (@fuxiadmin)

    it works now, thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘incorporating div into }else{’ is closed to new replies.