carolsanjose
asked on
php navigation - changing the default active tab
On this page is there a way to change the default tab to "pendant" from "view all'?
http://66.147.244.225/~minimosa/category/sterling-silver-pendant/
Attached is the php code for this page.
categorySubNavi.php
http://66.147.244.225/~minimosa/category/sterling-silver-pendant/
Attached is the php code for this page.
categorySubNavi.php
ASKER
I tried adding the code above to the php file listed & it didn't work.
No categories where highlighted & I didn't know what name to add since it is the 1st subcategory in the category. All of the category pages will have different 1st subcategories.
Thanks for trying to help.
ASKER
How do I remove the view all tab and have the 1st sub category tab be active?
Please tell me what to edit in the attached php file.
THank you.
Please tell me what to edit in the attached php file.
THank you.
<?php
// Sub Navigation for product categories for orientation. Brace yourself! (modify at your own risk)
//only run the foreach if categories were found
?>
<div class="SubCatNav">
<?php
$orderby = $OPTION['wps_catSubNav_orderbyOption'];
$order = $OPTION['wps_catSubNav_orderOption'];
if (!empty($childrenCats)) {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
#}elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) {
#$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
} else {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->parent.'&hide_empty=0&style=none&depth=1')),0,-6));
}
//only run the foreach if categories were found
if (trim($cats[0]) != 'No cate') {
//how many rows?
$wanted_rows = $OPTION['wps_catSubNav_rows'];
$num = count($cats);
$counter = 1;
$container = '<ul>';
foreach($cats as $cat){
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
$the_li_class = ($this_category->name == $catnam ? 'active' : NULL);
if($counter % $wanted_rows == 0){
$container .= "<li class='$the_li_class'>".$cat .'</li></ul><ul>';
} else {
$container .= "<li class='$the_li_class'>".$cat.'</li>';
}
$counter++;
}
wp_reset_query();
$ending = substr($container,-4);
if($ending == '<ul>'){
$container = substr($container,0,-4);
}
echo $container;
} ?>
<ul class="viewAll">
<?php if (!empty($childrenCats)) { ?>
<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>
<?php #} elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) { ?>
<!--<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>-->
<?php } else { ?>
<li><a href="<?php echo get_category_link($this_category->parent);?>"><?php _e('view all','wpShop');?></a></li>
<?php } ?>
</ul>
</div><!--end "Sub Navigation" section-->
<p style="float:left;margin-top:-20px;margin-left:20px;">Click image to
details:</p>
Please post your new question URL so I can help you further.
ASKER
ON this page:
http://66.147.244.225/~minimosa/category/tile-gallery/
How do I change the active landing tab from view all to the first tab listed? It will be a different 1st tab on other pages, so I can't just enter the name of the tab into the php file listed below.
How do I edit the code in the file list below to make the active landing tab the first tab in the navigation row?
http://66.147.244.225/~minimosa/category/tile-gallery/
How do I change the active landing tab from view all to the first tab listed? It will be a different 1st tab on other pages, so I can't just enter the name of the tab into the php file listed below.
How do I edit the code in the file list below to make the active landing tab the first tab in the navigation row?
<?php
// Sub Navigation for product categories for orientation. Brace yourself! (modify at your own risk)
//only run the foreach if categories were found
?>
<div class="SubCatNav">
<?php
$orderby = $OPTION['wps_catSubNav_orderbyOption'];
$order = $OPTION['wps_catSubNav_orderOption'];
if (!empty($childrenCats)) {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
#}elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) {
#$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
} else {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->parent.'&hide_empty=0&style=none&depth=1')),0,-6));
}
//only run the foreach if categories were found
if (trim($cats[0]) != 'No cate') {
//how many rows?
$wanted_rows = $OPTION['wps_catSubNav_rows'];
$num = count($cats);
$counter = 1;
$container = '<ul>';
foreach($cats as $cat){
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
$the_li_class = ($this_category->name == $catnam ? 'active' : NULL);
if($counter % $wanted_rows == 0){
$container .= "<li class='$the_li_class'>".$cat .'</li></ul><ul>';
} else {
$container .= "<li class='$the_li_class'>".$cat.'</li>';
}
$counter++;
}
wp_reset_query();
$ending = substr($container,-4);
if($ending == '<ul>'){
$container = substr($container,0,-4);
}
echo $container;
} ?>
<ul class="viewAll">
<?php if (!empty($childrenCats)) { ?>
<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>
<?php #} elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) { ?>
<!--<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>-->
<?php } else { ?>
<li><a href="<?php echo get_category_link($this_category->parent);?>"><?php _e('view all','wpShop');?></a></li>
<?php } ?>
</ul>
</div><!--end "Sub Navigation" section-->
<p style="float:left;margin-top:-20px;margin-left:20px;">Click image to
details:</p>
ASKER
Let me explain further...
On this parent category page (tile gallery) we want the opening page to not be "view all" but the 1st child category listed in the navigation. On this page the 1st child category is new tiles.
How do I make 1st child category the active landing page when the parent category is showing?
http://66.147.244.225/~minimosa/category/tile-gallery/
On this parent category page (tile gallery) we want the opening page to not be "view all" but the 1st child category listed in the navigation. On this page the 1st child category is new tiles.
How do I make 1st child category the active landing page when the parent category is showing?
http://66.147.244.225/~minimosa/category/tile-gallery/
Try using the following code:
<?php
// Sub Navigation for product categories for orientation. Brace yourself! (modify at your own risk)
//only run the foreach if categories were found
?>
<div class="SubCatNav">
<?php
$orderby = $OPTION['wps_catSubNav_orderbyOption'];
$order = $OPTION['wps_catSubNav_orderOption'];
if (!empty($childrenCats)) {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
#}elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) {
#$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
} else {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->parent.'&hide_empty=0&style=none&depth=1')),0,-6));
}
//only run the foreach if categories were found
if (trim($cats[0]) != 'No cate') {
//how many rows?
$wanted_rows = $OPTION['wps_catSubNav_rows'];
$num = count($cats);
$counter = 1;
$container = '<ul>';
$firstTab = true;
foreach($cats as $cat){
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
$the_li_class = ($firstTab ? 'active' : NULL);
if($counter % $wanted_rows == 0){
$container .= "<li class='$the_li_class'>".$cat .'</li></ul><ul>';
} else {
$container .= "<li class='$the_li_class'>".$cat.'</li>';
}
$firstTab = false;
$counter++;
}
wp_reset_query();
$ending = substr($container,-4);
if($ending == '<ul>'){
$container = substr($container,0,-4);
}
echo $container;
} ?>
<ul class="viewAll">
<?php if (!empty($childrenCats)) { ?>
<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>
<?php #} elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) { ?>
<!--<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>-->
<?php } else { ?>
<li><a href="<?php echo get_category_link($this_category->parent);?>"><?php _e('view all','wpShop');?></a></li>
<?php } ?>
</ul>
</div><!--end "Sub Navigation" section-->
<p style="float:left;margin-top:-20px;margin-left:20px;">Click image to
details:</p>
ASKER
I added the code above & this is what it looks like now:
http://66.147.244.225/~minimosa/category/tile-gallery/
What else to I need to tweak to make the view all tab not active?
http://66.147.244.225/~minimosa/category/tile-gallery/
What else to I need to tweak to make the view all tab not active?
Try the following:
<?php
// Sub Navigation for product categories for orientation. Brace yourself! (modify at your own risk)
//only run the foreach if categories were found
?>
<div class="SubCatNav">
<?php
$orderby = $OPTION['wps_catSubNav_orderbyOption'];
$order = $OPTION['wps_catSubNav_orderOption'];
if (!empty($childrenCats)) {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
#}elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) {
#$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
} else {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->parent.'&hide_empty=0&style=none&depth=1')),0,-6));
}
//only run the foreach if categories were found
if (trim($cats[0]) != 'No cate') {
//how many rows?
$wanted_rows = $OPTION['wps_catSubNav_rows'];
$num = count($cats);
$counter = 1;
$container = '<ul>';
$firstTab = true;
foreach($cats as $cat){
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
$the_li_class = ($firstTab ? 'active' : NULL);
if($counter % $wanted_rows == 0){
$container .= "<li class='$the_li_class'>".$cat .'</li></ul><ul>';
} else {
$container .= "<li class='$the_li_class'>".$cat.'</li>';
}
$firstTab = false;
$counter++;
}
wp_reset_query();
$ending = substr($container,-4);
if($ending == '<ul>'){
$container = substr($container,0,-4);
}
echo $container;
} ?>
<ul class="viewAll">
<?php if (!empty($childrenCats)) { ?>
<li><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>
<?php #} elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) { ?>
<!--<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>-->
<?php } else { ?>
<li><a href="<?php echo get_category_link($this_category->parent);?>"><?php _e('view all','wpShop');?></a></li>
<?php } ?>
</ul>
</div><!--end "Sub Navigation" section-->
<p style="float:left;margin-top:-20px;margin-left:20px;">Click image to
details:</p>
ASKER
We are getting there...thank you for your help.
Here is what it looks like after I added the code above:
http://66.147.244.225/~minimosa/category/tile-gallery/
Now, when I click on another tab, the active tab is not moving to reflect the current category.
What do I need to do to fix this?
Here is what it looks like after I added the code above:
http://66.147.244.225/~minimosa/category/tile-gallery/
Now, when I click on another tab, the active tab is not moving to reflect the current category.
What do I need to do to fix this?
ASKER
Actually, the active 1st tab is not displaying the proper category results. The new tiles tab is showing the tile galllery category, not the new tiles category.
When the first tab is highlighted, I want that category's results to show below.
When the first tab is highlighted, I want that category's results to show below.
<?php
// Sub Navigation for product categories for orientation. Brace yourself! (modify at your own risk)
//only run the foreach if categories were found
?>
<div class="SubCatNav">
<?php
$orderby = $OPTION['wps_catSubNav_orderbyOption'];
$order = $OPTION['wps_catSubNav_orderOption'];
if (!empty($childrenCats)) {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
#}elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) {
#$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
} else {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->parent.'&hide_empty=0&style=none&depth=1')),0,-6));
}
//only run the foreach if categories were found
if (trim($cats[0]) != 'No cate') {
//how many rows?
$wanted_rows = $OPTION['wps_catSubNav_rows'];
$num = count($cats);
$counter = 1;
$container = '<ul>';
$firstTab = true;
foreach($cats as $cat){
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
if ($catnam != '')
{
$the_li_class = ($this_category->name == $catnam ? 'active' : NULL);
} else {
if ($firstTab)
$the_li_class = 'active';
}
if($counter % $wanted_rows == 0){
$container .= "<li class='$the_li_class'>".$cat .'</li></ul><ul>';
} else {
$container .= "<li class='$the_li_class'>".$cat.'</li>';
}
$firstTab = false;
$counter++;
}
wp_reset_query();
$ending = substr($container,-4);
if($ending == '<ul>'){
$container = substr($container,0,-4);
}
echo $container;
} ?>
<ul class="viewAll">
<?php if (!empty($childrenCats)) { ?>
<li><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>
<?php #} elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) { ?>
<!--<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>-->
<?php } else { ?>
<li><a href="<?php echo get_category_link($this_category->parent);?>"><?php _e('view all','wpShop');?></a></li>
<?php } ?>
</ul>
</div><!--end "Sub Navigation" section-->
<p style="float:left;margin-top:-20px;margin-left:20px;">Click image to
details:</p>
If you still have a problem please post your full code so I can help you better.
ASKER
I added your code above & this is what I get:
http://66.147.244.225/~minimosa/category/tile-gallery/
There is no active tab.
Maybe it not possible what I am trying to do.
In a nutshell, I want the parent category page to display navigation for child categories, starting with the first category only showing in the results...not the view all results for that category.
I am going to close the question because I don't feel like we are getting there. Maybe what I am trying to do is not possible in wordpress loop.
http://66.147.244.225/~minimosa/category/tile-gallery/
There is no active tab.
Maybe it not possible what I am trying to do.
In a nutshell, I want the parent category page to display navigation for child categories, starting with the first category only showing in the results...not the view all results for that category.
I am going to close the question because I don't feel like we are getting there. Maybe what I am trying to do is not possible in wordpress loop.
ASKER
One more thing & I am ready to accept your answer & give you an A!
I'll use the code above which gives me this result:
http://66.147.244.225/~minimosa/category/tile-gallery/
GOOD - when I click on new tiles or abstract, the tab remains active.
BAD - the view all tab does not remain active after I click on it.
How do I make the view all tab work as active after it is clicked on?
Thanks for your patience & help!
I'll use the code above which gives me this result:
http://66.147.244.225/~minimosa/category/tile-gallery/
GOOD - when I click on new tiles or abstract, the tab remains active.
BAD - the view all tab does not remain active after I click on it.
How do I make the view all tab work as active after it is clicked on?
Thanks for your patience & help!
@carolsanjose: What you are trying to do is absolutely possible, however I am editing the code and posting here without doing any test.
If you could post the full code I will test it and give you the final code.
If you could post the full code I will test it and give you the final code.
ASKER
Above, we have been working on the code in the includes files called categorysubnav.php.
Here is the code to the category page.
Here is the code to the category page.
<?php
//collect options
$WPS_prodCol = $OPTION['wps_prodCol_option'];
$WPS_catCol = $OPTION['wps_catCol_option'];
$WPS_sidebar = $OPTION['wps_sidebar_option'];
$WPS_showposts = $OPTION['wps_showpostsOverwrite_Option'];
$this_category = get_category($cat);
$topParent = NWS_get_root_category($cat,'allData');
$topParentSlug = $topParent->slug;
$this_categorySlug = $this_category->slug;
//collect options
$orderBy = $OPTION['wps_secondaryCat_orderbyOption'];
$order = $OPTION['wps_secondaryCat_orderOption'];
//collect the child categories
$childrenCats = get_terms('category', 'orderby='.$orderBy.'&order='.$order.'&parent='.$this_category->term_id.'&hide_empty=0');
//collect the grandchild categories
foreach ($childrenCats as $childrenCat) {
$currentChildCat = $childrenCat->term_id;
$grandChildCats = get_terms('category', 'orderby='.$orderBy.'&order='.$order.'&parent='.$currentChildCat.'&hide_empty=0');
$grandNum = count($grandChildCats);
if ($grandNum > 0) {
$grandChildCats = TRUE;
break;
} else {
$grandChildCats = FALSE;
}
}
// sidebar location?
switch($WPS_sidebar){
case 'alignRight':
$the_float_class = 'alignleft';
break;
case 'alignLeft':
$the_float_class = 'alignright';
break;
}
// teaser?
if($OPTION['wps_teaser_enable_option']) {$the_eqcol_class = 'eqcol'; }
//what cat column option?
switch($WPS_catCol){
case 'catCol3':
$catCol_class = 'theCats3';
break;
case 'catCol4':
$catCol_class = 'theCats4';
break;
}
//what prod column option?
switch($WPS_prodCol){
case 'prodCol1':
$prodCol_class = 'theProds1';
break;
case 'prodCol2':
$prodCol_class = 'theProds2';
break;
case 'prodCol3':
$prodCol_class = 'theProds3';
break;
case 'prodCol4':
$prodCol_class = 'theProds4';
break;
case 'prodCol5':
$prodCol_class = 'theProds5';
break;
}
//set the div class
if (!empty($childrenCats)) {
if ($grandChildCats) {
$the_div_class = 'theCats clearfix '.$catCol_class. ' '.$the_float_class;
} else {
$the_div_class = 'theProds clearfix '.$prodCol_class. ' '.$the_float_class.' '.$the_eqcol_class;
}
} else {
$the_div_class = 'theProds clearfix '.$prodCol_class. ' '.$the_float_class.' '.$the_eqcol_class;
}
if($OPTION['wps_catDescr_enable']) {
echo term_description();
} ?>
<div class="<?php echo $the_div_class;?>">
<?php
//display subcategories if my category has children, otherwise display products. Display also products when there's no grandchildren!
if (!empty($childrenCats)) {
if ($grandChildCats) {
include (TEMPLATEPATH . '/includes/category/categoryDisplay.php');
} else {
include (TEMPLATEPATH . '/includes/category/productDisplay.php');
}
}
//otherwise display products
else {
include (TEMPLATEPATH . '/includes/category/productDisplay.php');
} ?>
<br/>
<br/>
</div><!-- theProds -->
<?php if ($WPS_prodCol != 'prodCol5') { ?>
</div><!-- main_col -->
<?php }
if ($WPS_prodCol != 'prodCol5') {
include (TEMPLATEPATH . '/widget_ready_areas.php');
}
get_footer(); ?>
The function 'get_category()' is missing, do you include from another script and you missed posting it here?
Something important, I want to know the variable '$catnam'.
Please use the following code and let me know so I will check the page to see the variable '$catnam' contents.
Something important, I want to know the variable '$catnam'.
Please use the following code and let me know so I will check the page to see the variable '$catnam' contents.
<?php
// Sub Navigation for product categories for orientation. Brace yourself! (modify at your own risk)
//only run the foreach if categories were found
?>
<div class="SubCatNav">
<?php
$orderby = $OPTION['wps_catSubNav_orderbyOption'];
$order = $OPTION['wps_catSubNav_orderOption'];
if (!empty($childrenCats)) {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
#}elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) {
#$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
} else {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->parent.'&hide_empty=0&style=none&depth=1')),0,-6));
}
//only run the foreach if categories were found
if (trim($cats[0]) != 'No cate') {
//how many rows?
$wanted_rows = $OPTION['wps_catSubNav_rows'];
$num = count($cats);
$counter = 1;
$container = '<ul>';
$firstTab = true;
foreach($cats as $cat){
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
if ($catnam != '')
{
$the_li_class = ($this_category->name == $catnam ? 'active' : NULL);
} else {
if ($firstTab)
$the_li_class = 'active';
}
echo "BEGIN VAR<br />";
echo "$counter: $catnam" . "<br /><br />";
echo "END VAR";
if($counter % $wanted_rows == 0){
$container .= "<li class='$the_li_class'>".$cat .'</li></ul><ul>';
} else {
$container .= "<li class='$the_li_class'>".$cat.'</li>';
}
$firstTab = false;
$counter++;
}
wp_reset_query();
$ending = substr($container,-4);
if($ending == '<ul>'){
$container = substr($container,0,-4);
}
echo $container;
} ?>
<ul class="viewAll">
<?php if (!empty($childrenCats)) { ?>
<li><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>
<?php #} elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) { ?>
<!--<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>-->
<?php } else { ?>
<li><a href="<?php echo get_category_link($this_category->parent);?>"><?php _e('view all','wpShop');?></a></li>
<?php } ?>
</ul>
</div><!--end "Sub Navigation" section-->
<p style="float:left;margin-top:-20px;margin-left:20px;">Click image to
details:</p>
I have posted objection since I am helping you here and I need some information as I said above so I can give you better solution.
ASKER
Here is what I got when I added your code above.
http://66.147.244.225/~minimosa/category/tile-gallery/
I am ready to finish this...I don't think we are getting there.
THis Wordpress theme & template is complicated and I think I am asking you to do something that is not possible.
Can we end this question now?
http://66.147.244.225/~minimosa/category/tile-gallery/
I am ready to finish this...I don't think we are getting there.
THis Wordpress theme & template is complicated and I think I am asking you to do something that is not possible.
Can we end this question now?
From my experience your question can be solved, so I think it's better to end the question with its solution to help other people who are searching for similar solutions.
I have updated the code.
I have updated the code.
<?php
// Sub Navigation for product categories for orientation. Brace yourself! (modify at your own risk)
//only run the foreach if categories were found
?>
<div class="SubCatNav">
<?php
$orderby = $OPTION['wps_catSubNav_orderbyOption'];
$order = $OPTION['wps_catSubNav_orderOption'];
if (!empty($childrenCats)) {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
#}elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) {
#$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->term_id.'&hide_empty=0&style=none')),0,-6));
} else {
$cats = explode("<br />",substr(trim(wp_list_categories('title_li=&echo=0&orderby='.$orderby.'&order='.$order.'&child_of='.$this_category->parent.'&hide_empty=0&style=none&depth=1')),0,-6));
}
//only run the foreach if categories were found
if (trim($cats[0]) != 'No cate') {
//how many rows?
$wanted_rows = $OPTION['wps_catSubNav_rows'];
$num = count($cats);
$counter = 1;
$container = '<ul>';
$tabSpecified = false;
foreach($cats as $cat) {
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
if ($this_category->name == $catnam)
{
$tabSpecified = true;
break;
}
}
foreach($cats as $cat) {
//set an active class on the current category
$parts1 = explode("</a>",$cat);
$parts2 = explode(">",$parts1[0]);
$catnam = trim($parts2[1]);
if ($tabSpecified)
{
$the_li_class = ($this_category->name == $catnam ? 'active' : NULL);
} else {
if ($counter == 0)
$the_li_class = 'active';
}
if($counter % $wanted_rows == 0){
$container .= "<li class='$the_li_class'>".$cat .'</li></ul><ul>';
} else {
$container .= "<li class='$the_li_class'>".$cat.'</li>';
}
$firstTab = false;
$counter++;
}
wp_reset_query();
$ending = substr($container,-4);
if($ending == '<ul>'){
$container = substr($container,0,-4);
}
echo $container;
} ?>
<ul class="viewAll">
<?php if (!empty($childrenCats)) { ?>
<li><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>
<?php #} elseif((empty($childrenCats)) && ($this_category->category_parent!=0)) { ?>
<!--<li class="active"><a href="<?php echo get_category_link($this_category->term_id);?>"><?php _e('view all','wpShop');?></a></li>-->
<?php } else { ?>
<li><a href="<?php echo get_category_link($this_category->parent);?>"><?php _e('view all','wpShop');?></a></li>
<?php } ?>
</ul>
</div><!--end "Sub Navigation" section-->
<p style="float:left;margin-top:-20px;margin-left:20px;">Click image to
details:</p>
ASKER
I added the code above.
Now this is what I get:
How do I make the View all tab stay highlighted when I click on that tab? Right now it stays grey.
http://66.147.244.225/~minimosa/category/tile-gallery/
Now this is what I get:
How do I make the View all tab stay highlighted when I click on that tab? Right now it stays grey.
http://66.147.244.225/~minimosa/category/tile-gallery/
ASKER
Is there something in this code change that would affect our front page slide show? Right now it is opening really slowly.
http://66.147.244.225/~minimosa/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I added the code you listed above.
Take a look:
http://66.147.244.225/~minimosa/category/tile-gallery/
I am ready to close the question now.
Take a look:
http://66.147.244.225/~minimosa/category/tile-gallery/
I am ready to close the question now.
I recommend closing this question by accepting http:#35420835
Open in new window
As you can see, the CSS class "active" is added to the tag "li" so it appear selected.
In your PHP code, change the line:
Open in new window
To:
Open in new window