NOT THIS AGAIN – keeping current nav highlighted
-
Hi,
This is the address of my site, it is still being built https://www.type4screen.com
I have been battling with trying to make the current navigation link remain highlighted…it just seems impossible. I feel really stupid posting this again.
I have followed previously posted topics (https://www.ads-software.com/support/topic/27626) and I have tried to decipher (https://codex.www.ads-software.com/Dynamic_Menu_Highlighting) and I just can’t understand (https://www.alistapart.com/articles/keepingcurrent/) in the context of a WP site.
Can anyone tell me how to apply this in the context of wp kubrick theme? For example, my navigation is in the sidebar.php and it doesn’t list each page in the code the way the examples cited above show it like this…
<div id=”navigation”>
-
<li id=”one”>Page One
<li id=”two”>Page Two
<li id=”three”>Page Three
<li id=”four”>Page Four</div>
In my sidebar.php, as I understand it the navigation side bar is generated from the way wp pages and categories are created – so each item on my navigation bar is not listed explicitly as it appears in the examples. How do I specify ids for each of my pages and categories that are created within wordpress and where do I put these ids the sidebar.php code? The code from my sidebar.php is at the end of this post.
Also in the header.php, what code do I write instead of the following (listed in the examples).
<?php
if ( is_page(‘Page One’) ) { $current = ‘one’; }
elseif ( is_page(‘Page Two’) ) { $current = ‘two’; }
elseif ( is_page(‘Page Three’) ) { $current = ‘three’; }
elseif ( is_page(‘Page Four’) ) { $current = ‘four’; }
?>In the header.php, how should I specify each page that I have created eg. Introduction, Articles, Literature review etc…
<?php
if ( is_page(‘Introduction’) ) { $current = ‘introduction’; }
elseif ( is_page(‘Articles’) ) { $current = ‘Articles’; }
elseif ( is_page(‘Literature Review’) ) { $current = ‘Literature review’; }
?>Also this is the inline css that I put in the header.php, can you tell me what is wrong with this…
<style type=”text/css” media=”screen”>
#<?php echo $current;???> {
color:#990000;
background-image: url(images/arrow.gif);
background-repeat: no-repeat;
background-position: 0 .3em;
padding-left: 12px;
}
</style>I have tried to follow the examples carefully but I just can’t get them to work. I would be really grateful if anyone can explain how to do this in the context of WP. Big THNX.
———-
MY SIDEBAR.PHP<div id=”sidebar”>
-
<?php wp_list_pages(‘sort_column=menu_order&title_li=<h2>’ . __(‘Research’) . ‘</h2>’ ); ?>
- <h2><?php _e(‘Topics’); ?></h2>
-
<?php list_cats(0, ”, ‘name’, ‘asc’, ”, 1, 0, 1, 1, 1, 1, 0,”,”,”,”,”) ?>
- <h2><?php _e(‘Archives’); ?></h2>
-
<?php wp_get_archives(‘type=monthly’); ?>
<?php get_links_list(); ?>
- <h2><?php _e(‘Meta’); ?></h2>
- <?php wp_loginout(); ?>
- “>WordPress
-
<br></br>
<?php include (TEMPLATEPATH . ‘/searchform.php’); ?>
<?php wp_meta(); ?>
<?php endif; ?>
</div>
—
- The topic ‘NOT THIS AGAIN – keeping current nav highlighted’ is closed to new replies.