Have you created a new custom page template in your child theme?
I have. I created a page called sidebar2-page.php, which shows up in the page template drop down menu.
If a I duplicate the code from the sidebar-page file, how can I get this page template to link with other widgets on the sidebar.
I tried editing the <?php get _Sidebar();?> line. Is that correct, or no?
I created a page called sidebar2-page.php, which shows up in the page template drop down menu.
No – you have to create a new Page template. Not a copy of a sidebar.
Ok. I can create a new page. From what I read, its:
<?php
/*
Template Name: My Custom Page
*/
Then what do I do? Naturally, the page is appearing blank, because there is nothing on the page.
Does the new page template call a new custom sidebar?
It does not. I am still trying to learn some of the coding required for WordPress.
Would you be able to point me in the direction where I might be able to figure out how to tell the page to call a new custom sidebar please?
the page template code could be based on a copy of sidebar-page.php of Twenty Eleven, just with a different Template Name.
you also need to add some coding into functions.php of the child theme to correct the body_class()
output;
see for example http://www.transformationpowertools.com/wordpress/twenty-eleven-new-page-template-with-sidebar-correction
for the different widgets, consider to use a plugin for ‘conditional widgets’ or ‘widget logic’ …
or a custom sidebar template and new sidebar;
http://codex.wordpress.org/Function_Reference/get_sidebar
http://codex.wordpress.org/Widgetizing_Themes
Thanks for your help alchymyth. So I added this code to the end of the functions.php file:
add_filter('body_class', 'adjust_body_class', 20, 2);
function adjust_body_class($wp_classes, $extra_classes) {
if( is_page_template('new-sidebar-page-template-file-name.php') ) :
// Filter the body classes
foreach($wp_classes as $key => $value) {
if ($value == 'singular') unset($wp_classes[$key]);
}
endif;
// Add the extra classes back untouched
return array_merge($wp_classes, (array) $extra_classes );
}
[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.]
And my page is not coming up at all anymore. I hadn’t had a functions.php file yet in my child theme directory. Do I need to copy ALL files over from the 2011 theme?
I hadn’t had a functions.php file yet in my child theme directory. Do I need to copy ALL files over from the 2011 theme?
http://codex.wordpress.org/Child_Themes#Using_functions.php
just start the new functions.php with this in the first line:
<?php
(nothing whatsoever before that code)
then add the suggested code – adapt the file name in the code to match the file name of your template.
That appears to be working! Thank you, although the new page is still showing the widgets from the main sidebar.
will either of the ‘conditional widgets’ or ‘widget logic’ plugins allow me to change which widgets now appear in this new page?
Thanks again for your help.
‘Conditional widgets’ is working somewhat, but I am still having difficulties getting any sidebar to appear on my newly created page.
Do I need to do anything to functions or the new page.php files?
Scratch that. I have managed to get it working! I really appreciate the help!!!