Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Tips, Tricks & Tutorials (http://www.datafeedr.com/forums/forumdisplay.php?f=66)
-   -   Hiding the sidebar on products (http://www.datafeedr.com/forums/showthread.php?t=9138)

digitalcow May 28th, 2013 06:40 AM

Hiding the sidebar on products
 
Wondering if anyone could offer me a little php advice. Eric helped me with this previously but don't want to trouble him again. I am trying to hide the sidebar on product pages and only show on categories pages. The template my store page uses is below

PHP Code:

<?php
/* Template Name: With Sidebar (Left) */
?>
<?php get_header
(); ?>

<!-- Title -->
<div class="box pt20 mainbox">
    <!-- Title -->
    <!-- Promo text -->
    <?php $promo get_post_meta($post->ID"_promo"$single false);?>
    <?php if(!empty($promo[0]) ):?>
       <div class="calloutcontainer">
            <div class="container_12">
                <div class="grid_12">            
                    <?php echo do_shortcode($promo[0]);?>
                </div>
            </div>
        </div>    
    <?php endif?>
    <div class="headertext">
        <?php the_title() ?>
        <?php $headline get_post_meta($post->ID"_headline"$single false);?>
        <?php if(!empty($headline[0]) ):?>
            <span><?php echo $headline[0?></span>
        <?php endif?>
    </div>
    <div class="clearnospacing"></div>
    
    <div class="container_12">
        <aside class="grid_3_no_margin sidebarleft alignleft">
            <?php generated_dynamic_sidebar() ?>
        </aside>
        <div class="grid_9 alignright omega">
            <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                <?php the_content(); ?>
            <?php endwhile; ?>    
        </div>
        <div class="clear"></div>
    </div>
</div>



<?php get_footer(); ?>

Have tried changing various bits but I either break the page or nothing happens

Eric May 28th, 2013 08:49 AM

Hi,

You might try changing this:
HTML Code:

    <div class="container_12">
        <aside class="grid_3_no_margin sidebarleft alignleft">
            <?php generated_dynamic_sidebar() ?>
        </aside>
        <div class="grid_9 alignright omega">
            <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                <?php the_content(); ?>
            <?php endwhile; ?>   
        </div>
        <div class="clear"></div>
    </div>

To this:
HTML Code:

<?php if (is_dfr('category')) : ?>
    <div class="container_12">
        <aside class="grid_3_no_margin sidebarleft alignleft">
            <?php generated_dynamic_sidebar() ?>
        </aside>
        <div class="grid_9 alignright omega">
            <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                <?php the_content(); ?>
            <?php endwhile; ?>   
        </div>
        <div class="clear"></div>
    </div>
<?php else : ?>
    <div class="container_12">
        <div class="grid_12">
            <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                <?php the_content(); ?>
            <?php endwhile; ?>   
        </div>
        <div class="clear"></div>
    </div>
<?php endif; ?>

Eric

digitalcow May 28th, 2013 08:59 AM

Perfect. Many thanks


All times are GMT -5. The time now is 02:02 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.