?
Solved

Adding and changing sidebars sidebars

Posted on 2014-02-10
15
Medium Priority
?
319 Views
Last Modified: 2014-03-04
Hi Guys,

I was wondering on my page here http://www.thedancingsoul.ie/?page_id=730 if it was
possible to  add a sidebar to the left? Also How do i change it soeverytime i name a page it wont appear in the body the way it says "Home Test" on this page?

thanks a mill
0
Comment
Question by:jonathanduane2010
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
15 Comments
 
LVL 25

Expert Comment

by:James Rodgers
ID: 39849963
adding sidebars is fairly straight forward but you will need to change teh page layout in order to accommodate a new sidebar

in your functions.php add something similar to

// Left-hand sidebar
$args = array(
	'name'          => __( 'Sidebar Left', 'theme-name' ),
	'id'            => 'sidebar-left',
	'description'   => 'Appears on Left Side of Some Pages',
    'class'         => '',
	'before_widget' => '<aside id="%1$s" class="widget %2$s">',
	'after_widget' 	=> '</aside>',
	'before_title' 	=> '<h3 class="widget-title">',
	'after_title' 	=> '</h3>'); 
	
register_sidebar( $args );

Open in new window


replace "theme-name" with your theme name, this is for translations
this will add it to your appearance>widgets page

copy your theme sidebar.php file and rename to sidebar-leftside.php

it should contain something similar to

<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
		<div id="secondary" class="widget-area" role="complementary">
			<?php dynamic_sidebar( 'sidebar-1' ); ?>
		</div><!-- #secondary -->
	<?php endif; ?>

Open in new window


replace all instances of 'sidebar-1' with 'sidebar-left'

on the page you want to add the new side bar add this,

<?php get_sidebar('leftside'); ?>

page styling will be up to you


replacing the page title is also pretty easy

add this to functions.php

add_filter( 'the_title', 'themename_title_filter' );

function themename_title_filter( $title ) {

if(is_page()){
$title="":
}
    return $title;

}

Open in new window


note: the above is untested, just wrote it out
0
 

Author Comment

by:jonathanduane2010
ID: 39850682
hi,

I get this when i change the functions.php :(

// Left-hand sidebar $args = array( 'name' => __( 'Sidebar Left', 'Primero' ), 'id' => 'sidebar-left', 'description' => 'Appears on Left Side of Some Pages', 'class' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '

'); register_sidebar( $args ); add_filter( 'the_title', 'themename_title_filter' ); function themename_title_filter( $title ) { if(is_page()){ $title="": } return $title; } 
Fatal error: Call to undefined function of_get_option() in /sites/thedancingsoul.ie/public_html/wp-content/themes/Primero/header.php on line 11

Open in new window

0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 39850729
is that the way it is actually coded on your functions page?
if it is the comment is going to cause issues
 place the cursor immediately after
// Left-hand sidebar

and press enter

save and try again

register side bar, add filter etc. should also be on it's own line, after every ";" (semi colon) have a new line
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:jonathanduane2010
ID: 39850766
i have removed everything from the the functions.php (there was nothing in it already) and i have also deleted the copy of the sidebar i made, but now i am getting an error about the header.php line 11 when i try to load the site?

http://www.thedancingsoul.ie

any ideas?

Thanks
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 39850810
not without knowing what is on line 11 of header.php

fix the header then start adding the code into functions.php one by one,

use the select all option at the bottom of the code window
0
 

Author Comment

by:jonathanduane2010
ID: 39850859
here is line 11

      <?php if(is_front_page() && of_get_option('home_title')): ?>

?

I just reverted to what was there

strange
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 39850940
the error is saying that the function of_get_option('home_title') does not exist
0
 

Author Comment

by:jonathanduane2010
ID: 39851025
and does it take that from the functions.php ?

When i ooked at that through wordpress i noticed there wasnt anythiong there, and now there still isnt anything there.
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 39851061
no, it means the function was
a) never created
or
b) could not be found any of the included theme or wordpress includes

it could be placed in the functions.php
0
 

Author Comment

by:jonathanduane2010
ID: 39851098
i havethethemeworking on another site can i copy the function file from there
0
 

Author Comment

by:jonathanduane2010
ID: 39864884
Hi there,

I have tried changing the functions.php and adding <?php get_sidebar('leftside'); ?> to this page http://www.thedancingsoul.ie/?page_id=21

But noting has changed...there is a sidebar on the right, but not on the left...

any ideas?
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 1820 total points
ID: 39867280
looks like you added it through the content editor not to the actual php page

i see
<p><?php get_sidebar('leftside'); ?></p>

on line 337 of the source
0
 

Author Comment

by:jonathanduane2010
ID: 39904298
Yes
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question