1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Quick PHP Question - I'm Lost.

Discussion in 'PHP & Perl' started by englandrm, Jan 2, 2011.

  1. englandrm

    englandrm Senior Member

    Joined:
    Nov 11, 2010
    Messages:
    942
    Likes Received:
    431
    Location:
    Canada
    It's a Wordpress page template. Someone made a custom theme, and I am trying to edit it for my client. It is based off the 2010 theme, but they changed a few of the templates around.

    The main page template does not have a sidebar, and I want to put one in. It looks like the layout with the sidebar is still in the stylesheet.

    I've tried looking this up, I can't find an explanation anywhere. I can get the sidebar to show up, but the page content is taking up the full width of the page, pushing the sidebar down.

    I think all I need to change is the bit right here, but I can't figure out what it means. I can't find an explanation of class"".

    Code:
    <div id="container" 
    			<div id="content" role="main">
    Here is the full page, if I'm wrong about the part.

    Code:
    <?php
    /*
    Template Name: Snarfer
    */
    ?>
    <?php
    /**
     * The template for displaying all pages.
     *
     * @package WordPress
     * @subpackage swingers
     */
    
    get_header(); ?>
    
    		<div id="container" 
    			<div id="content" role="main">
    
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<?php if ( is_front_page() ) { ?>
    						
    					<?php } else { ?>
    						<h1 class="entry-title"><?php the_title(); ?></h1>
    					<?php } ?>
    
    					<div class="entry-content">
    						<?php the_content(); ?>
    						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    						<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
    					</div>
    				</div>
    
    				
    
    <?php endwhile; ?>
    
    			</div>
    		</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    
    If it's a lot more difficult than a simple line of code, I guess I could go hire someone. I just thought I would ask here first. Thanks.
     
  2. locknload007

    locknload007 Jr. VIP Jr. VIP Premium Member

    Joined:
    Apr 14, 2010
    Messages:
    475
    Likes Received:
    67
    Try moving the sidebar before the closing div above it.
     
    • Thanks Thanks x 1
  3. locknload007

    locknload007 Jr. VIP Jr. VIP Premium Member

    Joined:
    Apr 14, 2010
    Messages:
    475
    Likes Received:
    67
    OK, the first div needs the > at the end, it is missing. Try fixing that first, if that dont work, then move it up one div as I suggested. I just feel looking at the code it should be inside the container div.
     
    • Thanks Thanks x 1
    Last edited: Jan 2, 2011