Grow your CSS skills. Land your dream job.

Help Fix my Sidebar Please

  • # January 16, 2012 at 4:09 pm

    Hey, I’ve been working on this site for a bit

    – My client has requested that I make a separate template for the first page so the main content area and the sidebar are not as tall/long.

    I achieved that with the main content area, but had tried pasting in the code I had in the sidebar.php file, in place of get_sidebar(), and it makes 2 duplicate sidebars instead of 1 static sidebar.

    I want to set a custom div for the sidebar in the index, so that it becomes shorter.

    I have already enabled a JS script that makes both the main-content and the sidebar’s heights equal to eachother, so that’s not the issue, the dynamic PHP stuff is.

    Your help would be greatly appreciated!

    Thanks!
    Adam

    # January 16, 2012 at 4:36 pm

    Hey Adam – you’re going to have to post some code for us to look at!

    # January 16, 2012 at 10:40 pm

    Hmmmm. Sounds like get_sidebar() is still being called somehow. . .

    # January 16, 2012 at 11:03 pm

    This is the index code:
    http://www.onedollaronebrick.org

    < ?php
    /*
    Template Name: One Dollar, One Brick: Home
    */

    get_header(); ?>


    All It Takes Is One Dollar.


    < ?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

    < ?php if ( is_front_page() ) { ?>
    < ?php } else { ?>
    < ?php } ?>

    < ?php the_content(); ?>
    < ?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'twentyten' ), 'after' => '' ) ); ?>
    < ?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>


    < ?php endwhile; ?>




    < ?php get_sidebar(); ?>

    < ?php get_footer(); ?>
    # January 16, 2012 at 11:09 pm

    Sidebar PHP Code:




    And here’s the style sheet:

    http://www.onedollaronebrick.org/style.css

    # January 16, 2012 at 11:28 pm

    Create a new file called sidebar-home.php. Then on your home template (which shouldn’t be index.php, by the way) you can use get_sidebar(‘home’).

    # January 17, 2012 at 12:53 am

    http://www.onedollaronebrick.org

    This is what happens, even when I insert the get_sidebar(‘home’) and created a sidebar-home.php file

    # January 17, 2012 at 1:01 am

    That is happening because you’re either calling

    < ?php get_sidebar(); ?>
    < ?php get_sidebar('home'); ?>

    Together or because your sidebar-home.php contains duplicate code.

    # January 21, 2012 at 4:29 pm

    Is there a way to figure out where the PHP code is that’s calling the sidebar twice?

    I don’t see < ?php get_sidebar(); ?> two times

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".