Making Forum Tab hilited when viewing forum
-
I am using the StudioPress theme and I have fully integrated bbpress into the theme. I think it looks great, and all the pages seem to be working. View at http:.//mipages.net/forum/ The only problem is that the “forum” tab isn’t hilited when viewing the forum. It always does the “home” one instead.
In my theme I hardcoded the first forum link to http://mipages.net/forum/
The second forum link is actually to just a page I created in wordpress called “forum”. I thought I could edit the link in phpmyadmin to http://mipages.net/forum/ somehow but I couldn’t seem to figure it out. So the link for the second forum tab is actually just a page, and not the actual forum.
So basically I just want one of those forum tabs to be hilited when viewing the forums. It doesn’t matter to me how to get it done. Any suggestions by anyone?
below is my header code for the forum page.
Code:<div id=”nav”>
<?php function get_the_pa_ges() {
global $wpdb;
if ( ! $these_pages = wp_cache_get(‘these_pages’, ‘pages’) ) {
$these_pages = $wpdb->get_results(‘select ID, post_title from ‘. $wpdb->posts .’ where post_status = “publish” and post_type = “page” order by ID’);}
return $these_pages;
}function list_all_pages(){
$all_pages = get_the_pa_ges ();
foreach ($all_pages as $thats_all){
$the_page_id = $thats_all->ID;if (is_page($the_page_id)) {
$addclass = ‘ class=”current_page”‘;
} else {
$addclass = ”;
}
$output .= ‘<li’ . $addclass . ‘>ID).'” title=”‘.$thats_all->post_title.'”><span>’.$thats_all->post_title.'</span>‘;
}return $output;
}
?>-
<?php
if (is_home()) {
$addclass = ‘ class=”current_page”‘;
} else {
$addclass = ”;
}
echo “<li” . $addclass . “><span>Home</span>“;if (is_page(‘190’) ) {
$addclass = ‘ class=”current_page”‘;
} else {
$addclass = ”;
}
echo “<li” . $addclass . “><span>Forum</span>“;echo list_all_pages();?>
<div class=”cleared”></div>
</div> <!– Closes Nav –>I changed the code to use the function is_page() when trying to identify it as a forum because that is what it looked like I needed to use, but I’m still pretty new to wordpress functions. the “190” is the id of the entry in my wp_posts table that contains the guid of http://mipages.net/forum/ (the link itself)
So I know it is kind of working, because it is grabbing the right url and everything, I just can’t get it to recognize that is is viewing that current page to add the class.
Help anyone! As soon as I can get this resolved I’d like to publish the modified theme files so other users can easily implement bbpress with their studiopress theme.
- You must be logged in to reply to this topic.