WordPress.org

Ready to get started?Download WordPress

Forums

Take sidebar off of one page only (14 posts)

  1. sponauglebl
    Member
    Posted 1 year ago #

    I would like to take the side bar off of my gallery pages (/gallery/landscapes; /gallery/insects; /gallery/fungi etc.) to showcase my photos better.

    I have perused the forums and have found what I believe to be viable answers to this question however one problem remains.

    I do not have the <?php get_sidebar(); ?> code in any of my PHP files for the theme "Photographic".

    All the answers I've found require using/editing/moving this. Any suggestions as to what I should do?

    Thank you in advance.

    http://upcavage.com

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    the sidebar is called from footer.php;

    first step;
    replace:
    <?php get_sidebar(); ?>
    with:
    <?php if( !is_page('gallery') ) get_sidebar(); ?>

    second step;
    you might need to adapt the css, based on .page-id-33

  3. sponauglebl
    Member
    Posted 1 year ago #

    Thank you! One more question, I'm trying to do this on all of my gallery pages...'landscapes' 'reptiles' etc. Repeating this code with a different page call is not working. How do I do this?

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    http://codex.wordpress.org/Function_Reference/is_page

    you can add multiple page IDs or slugs or names into the is_page() conditional tag

  5. sponauglebl
    Member
    Posted 1 year ago #

    Okay...I figured it out, but now my background color on the sidebar-less pages has reverted back to the original theme color. Any suggestions?

    This is what I did:

    <?php if( !is_page('landscapes') if( !is_page('fungi')if( !is_page('birdanimals')if( !is_page('culture') if( !is_page('insects')if( !is_page('plantflowers')if( !is_page('reptiles') ) get_sidebar(); ?>

  6. sponauglebl
    Member
    Posted 1 year ago #

    I simplified the code like your said but the background color is still off...and my slideshow has disappeared on the homepage...

  7. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    you have somehow broken some code so the execution stops where you edited the conditional sidebar stuff.

    please post the full code of footer.php;

    and while you are customizing your site, switch DEBUG on to get useful error messages: http://codex.wordpress.org/Debugging_in_WordPress

  8. sponauglebl
    Member
    Posted 1 year ago #

    </section>
    
    <?php if( !is_page(array('landscapes','reptiles',' 'plantflowers','culture','birdanimals','fungi','insects') ) get_sidebar(); ?>
    
          <hr />
    
    	  </div>
    
    		<footer>
          <!-- feel free to remove the credit below, but we'd love it if you would leave it in. -->
    			<p>
    				© <?php echo date("Y") ?> <?php bloginfo('name'); ?> | Powered by <a href="http://wordpress.org/">WordPress</a><?php if (is_home()) { ?> | Theme by <a href="http://www.stinkyinkshop.co.uk/themes/">Stinkyink</a><?php } ?><br />
    				<a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a>	and <a href="<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a>.
    			</p>
    		</footer>
    		<?php wp_footer(); ?>
    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-39249380-1']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
    
    	</body>
    </html>
  9. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    there is an unclosed bracket in the second line; should be:

    <?php if( !is_page(array('landscapes','reptiles',' 'plantflowers','culture','birdanimals','fungi','insects') ) ) get_sidebar(); ?>

    I haven't checked any further...

  10. sponauglebl
    Member
    Posted 1 year ago #

    It's fixed! Thank you for your help alchymyth. There was a space and an extra ' between reptiles and plantflowers.

    I don't know if I should open a new thread for this question, but I am trying to extend the content through where the sidebar was on all of my photo pages. i.e. I want each row to have three photos as opposed to two. I have played around a bit with this but haven't had any luck.

    http://upcavage.com/gallery/landscapes

  11. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    you might be able to do something from within functions.php of the theme;

    there is this section which adds a body_class if the sidebar is active:

    // hack to add a class to the body tag ifw
    function photographic_has_sidebar($classes) {
    	// add 'class-name' to the $classes array
    	$classes[] = 'has_sidebar';
    	// return the $classes array
    	return $classes;
    }
    
    if (is_active_sidebar('right_sidebar')) {
      add_filter('body_class','photographic_has_sidebar');
    }

    try and change the second-last line to:

    if (is_active_sidebar('right_sidebar') && !is_page(array('landscapes','reptiles','plantflowers','culture','birdanimals','fungi','insects') ) {

    (untested as I don't have the theme installed)

  12. sponauglebl
    Member
    Posted 1 year ago #

    Unfortunately it's not working, it's giving me a parse error on line 27 in the functions.php. I will start a new thread. Thank you for your help!

  13. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    my mistake, this time I forgot one closing bracket - corrected:

    if (is_active_sidebar('right_sidebar') && !is_page(array('landscapes','reptiles','plantflowers','culture','birdanimals','fungi','insects')) ) {

  14. sponauglebl
    Member
    Posted 1 year ago #

    Still giving me a parse error. Thank you for trying though!

Topic Closed

This topic has been closed to new replies.

About this Topic