WordPress.org

Ready to get started?Download WordPress

Forums

can't see "get_sidebar", what is calling my sidebar? (6 posts)

  1. bage1
    Member
    Posted 4 years ago #

    I'm using a theme that seems to be set up a bit differently than the basic type, and I can't figure how to remove the sidebar from single post pages.

    here is my single.php:

    <?php get_header(); ?>
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    			<h1><?php the_title(); ?></h1>
    			<div class="meta">
    				<?php if(get_option('uwc_dates_posts') == 'on') { echo '<div class="date">'; the_time("l, F j, Y"); echo '</div>'; } ?>
    				<?php if(get_option('uwc_authors_posts') == 'on') { echo 'By '; the_author(); } ?>
    			</div>
    			<div class="entry">
    				<?php $subtitle = get_post_meta($post->ID, 'subtitle', true);
    					if($subtitle) echo '<p class="sub">'.$subtitle.'</p>';
    				 ?>
    				 <?php the_content(); ?>
    				<?php the_tags( '<p class="tags"><small>Tags: ', ', ', '</small></p>'); ?>
    				<p class="postmetadata alt">
    					<small>
    						Published
    						on <?php the_time('l, F jS, Y') ?>, filed under <?php the_category(', ') ?>.
    					</small>
    				</p>
    			</div>
    		</div>
    	<?php comments_template(); ?>
    	<?php endwhile; else: ?>
    		<p>Sorry, no posts matched your criteria.</p>
    <?php endif; ?>
    <?php get_footer(); ?>

    there is no get_sidebar or include function but the sidebar is showing, any idea how its requested here?

  2. ClaytonJames
    Member
    Posted 4 years ago #

    This is just a blind guess, but check and see if it is being called from footer.php.

  3. bage1
    Member
    Posted 4 years ago #

    thanks, didn't find it in the footer but checked the header while at it, and seems like its called from there.

    how would I go about calling a different sidebar for index.php and single.php in this case? is there a way to call a different sidebar based on which page the header is on at that time?

  4. bage1
    Member
    Posted 4 years ago #

    would I be able to use something like this in sidebar.php?

    <?php
    
    if (is_page('index.php')){
    	<?php include(TEMPLATEPATH.'/sidebar-index.php'); ?>
    }
    
    elseif (is_page('single.php')){
    	<?php include(TEMPLATEPATH.'/sidebar-single.php'); ?>
    }
    
    else {
    	<?php include(TEMPLATEPATH.'/sidebar.php'); ?>
    }
    ?>
  5. bage1
    Member
    Posted 4 years ago #

    any ideas..?

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    Try:

    <?php
    if (is_page('index.php')) get_sidebar('index');
    elseif (is_page('single.php')) get_sidebar('single');
    else get_sidebar();
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic