I want to use a page template with the blog sidebar … can

Hello. I want to use a page template with the blog sidebar … can you give me advice how to configurate the page.php copy file to generate a new page template showing my sidebar with widgets – take a look here http://www.mach3.de.com/wordpress – the pages are different to the blog sites – the pages only show the content but not the sidebar – I want to change that :slight_smile: Greeting, Martin

  • Varick Addler
    • Design Lord, Child of Thor

    Hello. Thanks a lot. I want to integrate the current sidebar -> I copied the page.php and changed the name into page_sidebar.php -> that is the code I used:

    <?php

    /*

    Template Name:Blogpage+

    */

    ?>

    <?php get_header(); ?>

    <div id=”casing”>

    <div id=”fullcontent”>

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

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

    <div class=”post” id=”post-<?php the_ID(); ?>”>

    <h2 class=”storytitle”>” rel=”bookmark”><?php the_title(); ?> </h2>

    <div class=”storycontent”>

    <?php the_content(__(‘(more…:wink::wink:); ?>

    <div class=”clear”></div>

    <?php wp_link_pages(array(‘before’ => ‘<p>Pages: ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’:wink:); ?>

    </div>

    </div>

    <?php endwhile; else: ?>

    <h1 class=”title”><?php _e(‘Not Found’:wink:; ?></h1>

    <p><?php _e(‘Sorry, but you are looking for something that is not here.’:wink:; ?></p>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    But now the sidebar is after the content and not at the right side like it is at the post side??

    Can you tell me where to set the <?php get_sidebar(); ?> command.

    Martin

  • Jack Kitterhing
    • Code Norris

    Hi there Martin,

    I hope you are well today, as you have the get side bar command that is all you should need, with regards to placement of where it is, you may want to surround that with a `<div id=”youruniquenamehere”>

    <?php code here

    </div>`

    This way you can then align with CSS :slight_smile:

    You also want a custom page template, yes? With a two sidebar layout?

    Thank you!

    Kind Regards

    Jack.

  • Varick Addler
    • Design Lord, Child of Thor

    Sorry Jack, I dont realize what to do :slight_frown: can you add the command to the html code upside, please?! And yes, I want to fit another page with two sidebars on the left & right side? I am so angry about myself because I am such a dummy :slight_frown: Thanks Jack for your great support!!!!

  • Jack Kitterhing
    • Code Norris

    Hi there Martin,

    I hope you are well today, at the end of your code, after your last div, where you have

    </div>
    <?php endwhile; else: ?>
    <h1 class="title"><?php _e('Not Found'); ?></h1>
    <p><?php _e('Sorry, but you are looking for something that is not here.'); ?></p>
    <?php endif; ?>

    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Change that to

    </div>
    <?php endwhile; else: ?>
    <h1 class="title"><?php _e('Not Found'); ?></h1>
    <p><?php _e('Sorry, but you are looking for something that is not here.'); ?></p>
    <?php endif; ?>

    </div>
    <div id="custombar">
    <?php get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>

    Now the ID custombar you can style with CSS in your style.css file, so you can place it where you want, so your start your CSS like

    #custombar {
    position: absolute
    place further CSS commands on each line.
    }

    (you may want to change the position, that’s just an example :slight_smile:

    With setting the sidebar right and left, do you have a design set up? If you do, you can do this

    <?php get_header(); ?>
    <?php get_sidebar('left'); ?>
    <?php get_sidebar('right'); ?>
    <?php get_footer(); ?>

    The file names for the right and left sidebars should be sidebar-right.php and sidebar-left.php respectively.

    That will then check for a left sidebar and a right sidebar, and on this here

    This will create a sidebars named "RightSideBar" with <h1> and </h1> before and after the title:

    register_sidebar(array(
    'name' => __( 'Right Hand Sidebar' ),
    'id' => 'right-sidebar',
    'description' => __( 'Widgets in this area will be shown on the right-hand side.' ),
    'before_title' => '<h1>',
    'after_title' => '</h1>'
    ));

    That will register a sidebar, http://codex.wordpress.org/Function_Reference/register_sidebar what do you think of that?

    Thank you for being a WPMU DEV member!

    Kind Regards

    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.