Support » Themes and Templates » Custom Page Template Sidebar remnant

  • I just created a custom template to get rid of the sidebar on an inner page which worked successfully. However, any text I add is still behaving as if there is a sidebar there. Images span full width but text is being confined to the left side as if there is an “invisible” sidebar in place.

    To create the custom page I copied page.php and removed the sidebar reference, but I’m thinking something is left in there that’s causing this to happen. Here’s the code:

    Template Name: Custom
    <?php get_header(); ?>
                   <div id="wrapper">
                      <div id="content">
                            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                            if (has_post_thumbnail()) :
                              echo '<div class="thumbnail-p">';
                              echo '</div>';
                              echo "";
                            <h1 class="page-title"><?php the_title(); ?></h1>
                            <?php the_content(); ?>
                            <?php endwhile;
                             else: ?>
                             <p>Sorry, no posts matched your criteria.</p>
                             <?php endif; ?>
                       <?php dynamic_sidebar('page-bottom'); ?>
    <?php get_footer(); ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I tried removing : <?php dynamic_sidebar(‘page-bottom’); ?> but that removes the background and still leaves the same issue with the text. Can someone please help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael


    Forum Moderator

    you will likely need to adjusts some styles based on the custom template file name related CSS class (only if your theme uses body_class() )

    what theme are you working with?

    can you provide a link to a page with the custom template?

    It’s a custom theme (I didn’t actually design the site, just making some updates to it). Here’s a link to the page

    As you can see all the text is pushed over to the left while images are spanning full width. Appreciate any input you can provide!



    Forum Moderator

    please wrap the template name at the top of the template into php tags (right now it is showing at the top of the web page);

    <?php /*
    Template Name: Custom
    */ /.

    unfortunately, the theme does not use body_class() so you don’t have an easy specific CSS way of only formatting things in a page using the template.

    one way to add a template specific CSS class might be by editing this line:
    <div id="wrapper">
    <div id="wrapper" class="custom">

    then add some styles like:
    .custom #content { width: 100%; }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Page Template Sidebar remnant’ is closed to new replies.