Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to change the Top Navigation - 2 versions WordPress

  • SOLVED

<strong>Hi
From th Attached picture you can see my current top navigation. I am looking to have an "inside" and an "outside" to my site i.e. I want a member area that people log-into. however how do I completely change the top navigation on the inside – members content without changing the outside current navigation across the top?

I.e. the top navigation goes to the side bar and I can have a whole new members menu in the members part of the site that is protected content</strong>

The answer from Karma Customer service: Unfortunately the Karma theme does not have this functionality and requires pretty extensive customization.
We are unfortunately not available for customization work at this time. If you’re interested in hiring a programmer to help out with the customizations, we highly recommend to check out WPQuestions. It’s a great website that enables you to hire a WordPress Expert for all of your coding needs. It’s super fast, reliable and very affordable.


<strong>So can someone help me with this?</strong>
Thanks

The Theme header code is:


<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php theme_generator('title'); ?></title>
<?php if($custom_favicon = theme_get_option('general','custom_favicon')) { ?>
<link rel="shortcut icon" href="<?php echo $custom_favicon; ?>" />
<?php } ?>

<?php if ( function_exists( 'get_sliding_panel' ) ) get_sliding_panel(); ?>

<!-- Feeds and Pingback -->
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS2 Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php wp_head(); ?>

<!--[if IE 6 ]>
<link href="<?php echo THEME_CSS;?>/ie6.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?php echo THEME_JS;?>/dd_belatedpng-min.js"></script>
<script type="text/javascript" src="<?php echo THEME_JS;?>/ie6.js"></script>
<![endif]-->
<!--[if IE 7 ]>
<link href="<?php echo THEME_CSS;?>/ie7.css" media="screen" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE 8 ]>
<link href="<?php echo THEME_CSS;?>/ie8.css" media="screen" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE]>
<script type="text/javascript" src="<?php echo THEME_JS;?>/html5.js"></script>
<![endif]-->
<?php
if(theme_get_option('cufon','enable_cufon')){
theme_add_cufon_code();
}
?>
<script type="text/javascript">
var image_url='<?php echo THEME_IMAGES;?>';
</script>
<?php
if(theme_get_option('general','analytics') && theme_get_option('general','analytics_position')=='header'){
echo stripslashes(theme_get_option('general','analytics'));
}
?>
</head>
<body <?php body_class(); ?>>



<header id="header">
<div class="inner">
<?php if(theme_get_option('general','display_logo') && $custom_logo = theme_get_option('general','logo') ):
?>
<div id="logo">
<a href="<?php echo home_url( '/' ); ?>"><img class="ie_png" src="<?php echo $custom_logo; ?>" alt="<?php bloginfo('name'); ?>"/></a>
<?php if(theme_get_option('general','display_site_desc')){
$site_desc = get_bloginfo( 'description' );
if(!empty($site_desc)):?>
<div id="site_description"><?php bloginfo( 'description' ); ?></div>
<?php endif;}?>
</div>
<?php else:?>
<div id="logo_text">
<a id="site_name" href="<?php echo home_url( '/' ); ?>"><?php bloginfo('name'); ?></a>
<?php if(theme_get_option('general','display_site_desc')){
$site_desc = get_bloginfo( 'description' );
if(!empty($site_desc)):?>
<div id="site_description"><?php bloginfo( 'description' ); ?></div>
<?php endif;}?>
</div>
<?php endif; ?>
<?php $top_area_type = theme_get_option('general','top_area_type');
switch($top_area_type){
case 'html':
if(theme_get_option('general','top_area_html')){
echo '<div id="top_area">';
echo str_replace(array('[raw]','[/raw]'),'',do_shortcode(wpml_t(THEME_NAME, 'Top Area Html Code', stripslashes( theme_get_option('general','top_area_html') ))));
echo '</div>';
}
break;
case 'wpml_flags':
theme_generator('wpml_flags');
break;
case 'widget':
echo '<div id="top_area">';
dynamic_sidebar(__('Header Widget Area','striking_admin'));
echo '</div>';
break;
}
?>
<?php theme_generator('menu');?>
</div>
</header>

Answers (5)

2011-11-18

Francisco Javier Carazo Gil answers:

Hi Bookinars,

As Alistair said, you can also difference between roles.

If you want this:


<?php
if ( is_user_logged_in() )
{
$userRole = ($current_user->data->wp_capabilities);
$role = key($userRole);
unset($userRole);
$edit_anchr = '';
switch($role)
{
case 'administrator':
// here the code for administrator
break;

case 'editor':
// here the code for editor
break;

case 'contributor':
// here the code for contributor
break;

case 'author':
// // here the code for author
break;
}
}
else
{
//here the code for non logged-in
}


If you need more information about top navigation menu in WordPress, tell me. Try to see in which file is displayed "Member access" and then use this code, and create a bar for each case you need.

An example of bar:


<div id="navbar">
<div id="navbarleft">
<ul id="nav">
<li><a href="<?php echo get_settings('home'); ?>">Home</a></li>
<?php wp_list_pages('title_li=&depth=2&sort_column=menu_order'); ?>
</ul>
</div>
<div id="navbarright">
<ul id="nav">
<li><a href="<?php echo wp_logout_url(); ?>" title="Logout">Logout</a></li>
</ul>
</div>


If you need more help, ask.

2011-11-20

Gabriel Reguly answers:

Hi Bookinars,

Have you got your solution?

If not, please [[LINK href="http://wpquestions.com/question/extend/id/3404"]]Extend Question by 1 Day[[/LINK]] and let me try to help you.

If your theme has a header.php file, if would be nice to have it shown here.

Regards,
Gabriel


Bookinars comments:

Theme header is:


<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php theme_generator('title'); ?></title>
<?php if($custom_favicon = theme_get_option('general','custom_favicon')) { ?>
<link rel="shortcut icon" href="<?php echo $custom_favicon; ?>" />
<?php } ?>

<?php if ( function_exists( 'get_sliding_panel' ) ) get_sliding_panel(); ?>

<!-- Feeds and Pingback -->
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS2 Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php wp_head(); ?>

<!--[if IE 6 ]>
<link href="<?php echo THEME_CSS;?>/ie6.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?php echo THEME_JS;?>/dd_belatedpng-min.js"></script>
<script type="text/javascript" src="<?php echo THEME_JS;?>/ie6.js"></script>
<![endif]-->
<!--[if IE 7 ]>
<link href="<?php echo THEME_CSS;?>/ie7.css" media="screen" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE 8 ]>
<link href="<?php echo THEME_CSS;?>/ie8.css" media="screen" rel="stylesheet" type="text/css">
<![endif]-->
<!--[if IE]>
<script type="text/javascript" src="<?php echo THEME_JS;?>/html5.js"></script>
<![endif]-->
<?php
if(theme_get_option('cufon','enable_cufon')){
theme_add_cufon_code();
}
?>
<script type="text/javascript">
var image_url='<?php echo THEME_IMAGES;?>';
</script>
<?php
if(theme_get_option('general','analytics') && theme_get_option('general','analytics_position')=='header'){
echo stripslashes(theme_get_option('general','analytics'));
}
?>
</head>
<body <?php body_class(); ?>>



<header id="header">
<div class="inner">
<?php if(theme_get_option('general','display_logo') && $custom_logo = theme_get_option('general','logo') ):
?>
<div id="logo">
<a href="<?php echo home_url( '/' ); ?>"><img class="ie_png" src="<?php echo $custom_logo; ?>" alt="<?php bloginfo('name'); ?>"/></a>
<?php if(theme_get_option('general','display_site_desc')){
$site_desc = get_bloginfo( 'description' );
if(!empty($site_desc)):?>
<div id="site_description"><?php bloginfo( 'description' ); ?></div>
<?php endif;}?>
</div>
<?php else:?>
<div id="logo_text">
<a id="site_name" href="<?php echo home_url( '/' ); ?>"><?php bloginfo('name'); ?></a>
<?php if(theme_get_option('general','display_site_desc')){
$site_desc = get_bloginfo( 'description' );
if(!empty($site_desc)):?>
<div id="site_description"><?php bloginfo( 'description' ); ?></div>
<?php endif;}?>
</div>
<?php endif; ?>
<?php $top_area_type = theme_get_option('general','top_area_type');
switch($top_area_type){
case 'html':
if(theme_get_option('general','top_area_html')){
echo '<div id="top_area">';
echo str_replace(array('[raw]','[/raw]'),'',do_shortcode(wpml_t(THEME_NAME, 'Top Area Html Code', stripslashes( theme_get_option('general','top_area_html') ))));
echo '</div>';
}
break;
case 'wpml_flags':
theme_generator('wpml_flags');
break;
case 'widget':
echo '<div id="top_area">';
dynamic_sidebar(__('Header Widget Area','striking_admin'));
echo '</div>';
break;
}
?>
<?php theme_generator('menu');?>
</div>
</header>


Gabriel Reguly comments:

Hi Bookinars,

Seems function <em>theme_generator('menu')</em> is where the menu is generated.

If you could post it here, I can suggest want can be done.

Else you could PM with the FTP details so I can have a direct look into it.

Regards,
Gabriel


Gabriel Reguly comments:

Hi Bookinars,

Thanks for site access. I did a bit of work already.

Please check the site and tell me more about the correct placement of the menus.

Regards,
Gabriel


Gabriel Reguly comments:

Hi Bookinars,

I am glad you liked the solution.

Please do not forget to [[LINK href="http://wpquestions.com/question/pickAWinner/id/3404"]]award me the prize[[/LINK]] ;-)

Regards,
Gabriel

2011-11-17

Jerson Baguio answers:

Can you send me login details and ftp i can handles this for you.

2011-11-17

Pixel Coder answers:

Hi, You'd be looking to utilise the


is_user_logged_in();


Function available in WordPress, and perform a little bit of conditional logic to show the correct navigation in each area.

It would run something like this...


<div class="header">
<?php if(!is_user_logged_in()) : ?>
<a href="#" id="toggle-login-form">Members access</a>
<?php else : ?>
<ul class="loggedin-nav">
<li><a href="link-to-private-page">Private page</a>
</ul>
</div>


You would then look to modify your other WordPress theme files that display content you require hidden until logged in accordingly.

Depending on the member type e.g. Admin, Editor, Author, Subscriber you can perform deeper levels of authentication on a per role basis.

Hope that helps.

2011-11-17

ej_emman answers:

Hello,


This is a good reference and more detailed explaination for beginner...


[[LINK href="http://codex.wordpress.org/Function_Reference/is_user_logged_in#Examples"]]http://codex.wordpress.org/Function_Reference/is_user_logged_in#Examples[[/LINK]]


hope this helps.


ej_emman comments:

Hello Bookinars,

At your header.php, I see this line

<blockquote><?php theme_generator('menu');?> </blockquote>

This line is responsible for calling the main navigation menu. so if you want to have different menu between members and non members, you just replace it with this. But first you have to create two navigation menu in your
Appearance->Menus..

I assume you create "member menu name" and "non member menu name";

<?php
if ( is_user_logged_in() ) {
//for members menu
wp_nav_menu('menu'=>'member menu name' );
} else {
//for non-members menu
wp_nav_menu('menu'=>'non member menu name' );
}
?>

try this and tell me if it helps.