0
votes

I'm trying to set up a commercial website using Wordpress and I'm experimenting with different themes. I like "application", but I would like to get rid of the sidebar in "pages" (as opposed to "posts"). So I figured I would edit the template. I believe that is the file "page.php." I'm just learning PHP so some of this is mysterious. My immediate question is how to get rid of the sidebar, but more important than that, I just want to ask some basic questions about the structure of this file.

Here is page.php in the themes/application directory:

<?php get_header(); ?>

    <!--content-->
    <div id="content">

      <div id="left-col">

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

        <div class="post-head-page">

          <?php if ( is_front_page() ) { ?>
            <h1><?php the_title(); ?></h1>
          <?php } else { ?> 
            <h1><?php the_title(); ?></h1>
          <?php } ?>        

        </div><!--post-heading end-->

          <div class="post-entry">

            <?php the_content(); ?>
            <div class="clear"></div>
            <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'application' ), 'after' => '' ) ); ?>

          </div><!--post-entry end-->

          <?php comments_template( '', true ); ?>


<?php endwhile; ?>
</div> <!--left-col end-->

<?php get_sidebar(); ?>

</div> <!--content end-->

</div>
<!--wrapper end-->
<?php get_footer(); ?>

Basic questions:

  • Does this represent the structure of both Pages and Posts? I only care about Pages (I won't use posts in my website; it's a commercial website)

  • I'm told that when I create a custom template, I have to conform to the structure of the pages in my theme. What is the "structure" of this file? How can I tell what that is for my theme?

  • And if you can see a simple way to remove the sidebar let me know.

1

1 Answers

1
votes
  • This file only represents the structure for pages. Not for posts. To see what templates are used for what content, see this documentation, including a nice diagram.

  • I believe they mean that you'll need to keep the same html/php structure as in this file. When creating custom page templates, duplicate this file and then start adjusting it to your needs.

  • Remove the line with get_sidebar() to remove the sidebar.

Hope that helps!