WordPress.org

Support

Support » How-To and Troubleshooting » Different Template Format for Pages?

Different Template Format for Pages?

  • Hi,

    I’m in the process of setting up my blog at http://www.accessoryfetish.com.

    I really like the 3 column theme for most of the site. I’ve signed up as an ebay affiliate and want to have listings automatically populate. Problem is…the center column is too narrow for the content to fit.

    Is there a way to create a new template with only the left column, and the center and right column combined into one?

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Sure, just create (as you mentioned) a new Page template. Have a look at Pages. Scroll down a bit for the “how-to” portion.

    I had read this, copied my page.php file and created a new template. Being an html hack, this is where I run into a wall. I don’t see anything in the code that relates to either column. This is my page.php file:

    <?php get_header(); ?>

    <div id=”content”>

    <?php if (have_posts()) : ?>

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

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2 class=”posttitle”>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?>
    </h2>
    <p class=”postmeta”>Written by <?php the_author() ?></p>
    <div class=”the_content”>
    <?php the_content(); ?>
    </div>
    </div>

    <?php endwhile; else: ?>

    <div class=”post”>
    <h2 class=”posttitle”>Sorry, no posts matched your criteria</h2>
    </div>

    <?php endif; ?>

    </div>

    <?php get_footer(); ?>

    How would I edit this to remove one of the columns?

    Thanks for any help!

    Look in header.php and footer.php. And sidebar.php too, if you see get_sidebar() in one of those two files.

    It’s at the very end of header.php.

    Then it is probably in sidebar.php.

    so…are you saying I can create a second sidebar php file and be able to choose either when I create a new page?

    You could do that. But there is a much easier way. Assuming that both sidebars are coming from sidebar.php, just use the appropriate conditional tags to control what shows up.

    Note the heading “variable sidebar content” in the conditional tags article.

    ok. Things are coming clearer to me…although I just tried to hack my way through and couldn’t figure it out!

    What I would like is to only display “sidebar_one” on all Pages.

    So, I need to insert this:

    } elseif (is_single()) {

    somewhere in the sidebar.php file. But…I’m not sure where, and what other code I need to include.

    anyone have any more advice?

    Thanks!

    Every theme’s sidebar.php file is different, so you’re going to need to either figure it our on your own or post some of the code you want to ask about here. If it’s a long bit of code, then paste it into http://wordpress.pastebin.ca/

    cool…here’s the sidebar.php code. Again, I only want sidebar_one to appear on my Pages.

    <div class=”sidebar” id=”sidebar_one”>

      <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Sidebar 1’) ) : ?>

      <li id=”search”><h2>Search</h2>
      <form method=”get” id=”searchform” action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”>
      <div>
      <input type=”text” value=”<?php echo wp_specialchars($s, 1); ?>” name=”s” id=”s” />
      </div>
      </form>

    • <h2>Recent posts</h2>
        <?php get_archives(‘postbypost’,’10’,’custom’,’

      • ‘,’
      • ‘); ?>

    • <h2>Categories</h2>
        <?php wp_list_cats(‘sort_column=name&optioncount=1’); ?>
    • <h2>Pages</h2>
        <?php wp_list_pages(‘exclude=13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48’ );?>
    • <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Sidebar 2’) ) : ?>

      <?php get_links_list(); ?>

    • <h2><?php _e(‘Meta’); ?></h2>

      </div>

      <div class=”sidebar” id=”sidebar_two”>

        <script language=JavaScript>
        document.write (‘<a href=”‘);
        document.write(‘http://www.stumbleupon.com/submit? url=’+document.URL+’&title=’+document.title.replace(/ /g,’+’)+'”>’);
        document.write (‘<img border=0 src=/photos/Stumblelogo.bmp>’);
        </script>

      • <h2>Featured Product</h2>
        <img src=”http://www.accessoryfetish.com/photos/Turbo-RAT.jpg”>

        <?php endif; ?>

      </div>

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Different Template Format for Pages?’ is closed to new replies.