Yes, you can have different views for different pages. Here is link for more details http://codex.wordpress.org/Page_Templates
How this works? You want full page without sidebar for blog and tutorial. Then, create a file blog-tuts.php in your theme/child theme directory.
<?php
/**
* Template Name: Blogs and Tutorials
*/
get_header(); ?>
<div id="main">
some code here, and no sidebar
</div>
<?php get_footer();
This way, you can create different template for different pages. And, can create complex themes as well.
When, you create new page designated to particular page. Then, you have to choose from Page Attributes to suit your needs
how to add multiple pages?
im using windows flotform.in htdocs wordpress detects only index page if i use contactus page it shows whitescreen error.
Ok. I want the sidebar with only a few widgets on those pages not like the frontpage layout.
Hello @shravankumar,
It will load index page by default. You need to check page settings from Settings > Reading, and have to choose which static page you want as home page. You must have that page [if you want contact page as front page of your website – then, you must have that page created]
For next time, create a new thread.
Thanks,
Hello Hrohibil,
You can have as many widgets you want – either dynamic sidebar is at side or footer.
I think that you want different sidebar for different page as well.
In that case, just for example, you want sidebar for blogtuts.php. First you need to widgetize your theme.
<?php
/**
* Register our sidebars and widgetized areas.
*/
function my_widgets_init() {
register_sidebar( array(
'name' => 'Blog and Tutorial Sidebar',
'id' => 'blogsntuts',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'my_widgets_init' );
?>
Then, you must have sidebar-blogtuts.php to represent that sidebar which contain call code.
<?php if ( is_active_sidebar( 'blogsntuts' ) ) : ?>
<div id="idebar" role="complementary">
<?php dynamic_sidebar( 'blogsntuts' ); ?>
</div><!-- #primary-sidebar -->
<?php endif; ?>
Then, your blog-tuts template code will be.
<?php
/**
* Template Name: Blogs and Tutorials
*/
get_header(); ?>
<div id="main">
some code here, and no sidebar
<?php get_sidebar( 'blogtuts'); ?>
</div>
<?php get_footer();
Remember, http://codex.wordpress.org is a great place to start.
Thanks,
Thank you so much for elaborate that.
Ok, i have allready lots of widgets. From dashboard in the widgets tab, i can arrange the sidebar widgets for homepage by adding to the home sidebar tab.
You are cotrect that i want to have different widgets order/layout on different pages. But i also see tabs that are named main sidebar, footer etc… Can i somehow use One of those and then just change the page attributes? ?
Or do i have to do that setup from above?? At least i have a child theme setup in case..
It is simple. You just need to have a registered widget, and a call of it.
if you want to use a existing sidebar. Then, call to that sidebar-
sidebar-[slug].php –> <?php get_sidebar( ‘slug’ ); ?>