WordPress.org

Ready to get started?Download WordPress

Forums

Seashore theme - can I move the sidebar? (7 posts)

  1. ihatemydreams
    Member
    Posted 6 years ago #

    I have had great luck customizing the Seashore theme but was wondering if anyone knew if it was possible to move the first sidebar to the left. In other words, I would like a sidebar on either side of the body rather than the current setup of body to the left, then sidebar 1 and sidebar 2 to the right.

    While I know enough CSS and HTML to do some damage but I'm not an expert so please keep that in mind when answering.

    Thanks - here's the site I am currently working on...
    http://www.ihatemydreams.com

  2. rmk80
    Member
    Posted 6 years ago #

    I don't know the theme you are describing, but to have your content between the two sidebars you need to change the order in your theme's files.

    for example, if you open your theme's index.php, it will probably look something like this:

    <?php get_header(); ?>
    code for content also know as "the loop"
    code for sidebar 1
    code for sidebar 2
    <?php get_footer(); ?>

    you need to change the order into something like this:

    <?php get_header(); ?>
    code for sidebar 1
    code for content also know as "the loop"
    code for sidebar 2
    <?php get_footer(); ?>

    You need to do this for all theme files that generate a complete page (like index.php, page.php, category.php, tag.php, search.php and so on...)

    Also if your layout looks all scrambled afterwards, you need to edit the css properties for both the sidebars and the content to fit your needs. Since i have no clue about how your css looks, i can't give you more specific help. I hope you understand what i suggest.

  3. ihatemydreams
    Member
    Posted 6 years ago #

    Thanks, makes sense. I will give it a try and report back - Thanks!

  4. ihatemydreams
    Member
    Posted 6 years ago #

    Well, I played around with it a bit but only managed to make my page look insanely wrong. I only have a line for one sidebar in my index.php so maybe it will require a major overhaul. Here's my index..

    <?php get_header();?>
    
    <div id="main">
    
    	<div id="content">
    
    	    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	        <div class="post" id="post-<?php the_ID(); ?>">
    
                <p class="date">
    
                  <span class="month">
    
                    <?php the_time('M') ?>
    
                  </span>
    
                  <span class="day">
    
                    <?php the_time('d') ?>
    
                  </span>
    
                  <span class="year">
    
                    <?php the_time('Y') ?>
    
                  </span>
    
                  </p>
    
                <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
                <div class="meta">
    
    				      <p>Published by <?php the_author_posts_link() ?>  under <?php the_category(',') ?> <?php edit_post_link(); ?></p>
    
    			      </div>
    
    			      <div class="entry">
    
                  <?php the_content(__('Continue Reading »')); ?>
    
                  <?php wp_link_pages(); ?>
    
                  <p class="post-tags">
    
                    <?php if (function_exists('the_tags')) the_tags('Tags: ', ', ', '<br />'); ?>
    
                  </p>
    
          			</div>
    
                <p class="comments">
    
                  <?php comments_popup_link(__('No comments yet'), __('One comment so far'), __('% responses so far')); ?>
    
                </p>	          
    
    	        </div>
    
          <?php endwhile; else: ?>
    
              <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    
          <?php endif; ?>
    
          <p align="center"><?php posts_nav_link(' - ','« Prev','Next »') ?></p>
    
    	</div>
    
      <?php get_sidebar();?>  
    
      <?php get_footer();?>
  5. rmk80
    Member
    Posted 6 years ago #

    Hi,
    your theme does indeed have just one line to call for both the sidebars. that means that your theme's sidebar.php must contain the code for both the sidebars. it will probably look something like this:

    <div id="sidebar1" class="sidecol">
           code for sidebar 1
    </div>
    <div id="sidebar2" class="sidecol">
           code for sidebar 2
    </div>

    So you now you need to split them so we can put your content in betweens them. put this part of code:

    <div id="sidebar1" class="sidecol">
           code for sidebar 1
    </div>

    in a new file called leftsidebar.php and put the other part of the code:

    <div id="sidebar2" class="sidecol">
           code for sidebar 2
    </div>

    in a new file called rightsidebar.php
    Note that both files start with a div and end with a closing div tag.(eg <div>..</div>)

    Now you have to change your index.php ( and page.php, category.php, tag.php, search.php and so on...) so that

    <?php get_sidebar();?>

    gets replaced by two calls for our new two sidebar files. Your index.php will probably look like this afterwards:

    <?php get_header();?>
    
    <?php include(TEMPLATEPATH."/leftsidebar.php"); ?>
    
    <div id="main">
    
    	<div id="content">
    
    	    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	        <div class="post" id="post-<?php the_ID(); ?>">
    
                <p class="date">
    
                  <span class="month">
    
                    <?php the_time('M') ?>
    
                  </span>
    
                  <span class="day">
    
                    <?php the_time('d') ?>
    
                  </span>
    
                  <span class="year">
    
                    <?php the_time('Y') ?>
    
                  </span>
    
                  </p>
    
                <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
                <div class="meta">
    
    				      <p>Published by <?php the_author_posts_link() ?>  under <?php the_category(',') ?> <?php edit_post_link(); ?></p>
    
    			      </div>
    
    			      <div class="entry">
    
                  <?php the_content(__('Continue Reading »')); ?>
    
                  <?php wp_link_pages(); ?>
    
                  <p class="post-tags">
    
                    <?php if (function_exists('the_tags')) the_tags('Tags: ', ', ', '<br />'); ?>
    
                  </p>
    
          			</div>
    
                <p class="comments">
    
                  <?php comments_popup_link(__('No comments yet'), __('One comment so far'), __('% responses so far')); ?>
    
                </p>	          
    
    	        </div>
    
          <?php endwhile; else: ?>
    
              <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    
          <?php endif; ?>
    
          <p align="center"><?php posts_nav_link(' - ','« Prev','Next »') ?></p>
    
    	</div>
    
      <?php include(TEMPLATEPATH."/rightsidebar.php"); ?>
    
      <?php get_footer();?>

    Notice the differences:

    just after

    <?php get_header();?>

    i put this line for your left sidebar:

    <?php include(TEMPLATEPATH."/leftsidebar.php"); ?>

    and i replaced

    <?php get_sidebar();?>

    by

    <?php include(TEMPLATEPATH."/rightsidebar.php"); ?>

    this should be the trick to achieve what you want, although you still might need to change some style properties in your css file(like align, margins, etc,).

  6. ihatemydreams
    Member
    Posted 6 years ago #

    rmk80 - wow, thank you so much for taking the time to spell that out! I am going to hunker down and give it a try.

    Thanks!

  7. ihatemydreams
    Member
    Posted 6 years ago #

    Well, it worked but now I need to figure out how to tweak it. The two sidebars are in the right place but the formatting is kind of out of whack.

    Thanks again for getting me started. I'm testing it on a yet to be launched blog.

Topic Closed

This topic has been closed to new replies.

About this Topic