Jump to content

New sidebar in wordpress site


ulises2010

Recommended Posts

Hi, I need to show a diferent sidebar for logued an unlogued visitors.
 
I try this:
 
I create a new sidebar in functions.php whit this code:
 
register_sidebar(array(
		'name' => 'Sidebar para logueados',
		'id' => 'sidebar-logueados',
		'before_widget' => '',
		'after_widget' => '</div> <!-- end .widget -->',
		'before_title' => '<h4 class="main-title widget-title">',
		'after_title' => '</h4><div class="widget">',
    ));
Whit this, I have a new sidebar under aparence-->widgets where I can put difernts widgets
 
After, I go to the page template (page.php) and change this code
 
<?php get_sidebar(); ?>

 whit this one

 
<?php
get_currentuserinfo() ;
global $user_level;
if ($user_level > 0) {
echo get_sidebar('sidebar-logueados');;
} else {
echo get_sidebar();;
}
?>
I think all is ok, but don't works.... can anybody help me?
 
Thanks
Link to comment
https://forums.phpfreaks.com/topic/283926-new-sidebar-in-wordpress-site/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.