[resolved] Is it possible to make a conditional sidebar with Sidebar Generator? (2 posts)

  1. carrieduncan
    Posted 6 years ago #

    I'm attempting to make a dynamic sidebar from scratch knowing next to nothing about PHP. (Couldn't get Sidebar Generator to work or find another compatible plugin.) There's different content (differently styled) depending on the page:

    1. On pages About, Classes, Testimonials, and Resources, there will be a picture. (This part of the code was tested and found to work.)
    2. Pages Ask and Connect will each have a different form (that have been working fine all along).
    3. Pages based on single.php, category.php, archive.php, and search.php will have a sidebar that pretty much mimics the footer.*
    4. The Calendar page will have a calendar <?php ec3_get_calendar(); ?> in the sidebar.

    The site:
    The category page template:
    The sidebar:

    *I removed

    <?php get_sidebar( 'sidebar.php' ); ?>
    from category.php (post-paste) so you can see the basic sidebar that will appear on single.php, category.php, archive.php, and search.php.

    Thanks so much for any insight you can offer.

  2. carrieduncan
    Posted 6 years ago #

    Wish I could edit the title, mean to delete "with Sidebar Generator," as I couldn't get it to work.

    I ended up making a sidebar for all the pages (based on page.php) that had pictures and calling that sidebar in page.php:

    <div id="sidebar">
    <img src="http://www.carrieduncandesign.com/wordpress/wp-content/themes/LR/images/<?php
    if (is_page( 'about' )) {print 'checkbook.jpg" alt="About" />';
    }elseif (is_page( 'classes' )) {print 'class.jpg" alt="Classes" />';
    }elseif (is_page( 'testimonials' )) {print 'table.jpg" alt="Tests" />';
    }elseif (is_page( 'resources' )) {print 'resources.jpg" alt="Rescs" />';
    }else {
    print '&nbsp;';
    </div><!-- sidebar -->

    ...then followed instructions in
    to create sidebars for the widgets the plug-ins required.

    Not so elegant, but it worked.

    All of this from a few hints on another question:

    Thanks, esmi and blondishnet!

Topic Closed

This topic has been closed to new replies.

About this Topic