I have a taxonomy list A to Z... I am trying to create a conditional so that the current taxonomy page I am on highlights the appropriate navigation item.
For Example taxonomy view displays links |A|B|C|D|E|F|G|... etc
When some one click "B", I want to change the style so that B is bolded and is a different color while all of the other links stay the same as they were.
I feel like I am over thinking this, This is what I am using for my loop. Screen shots are attached.
<div class="hide-at-414">By Last Name:
<wpv-loop>
[wpv-conditional if="( '[wpv-taxonomy-title]' eq '[wpv-taxonomy-slug]' )"]
<span class="alpha-font-active">[wpv-taxonomy-link]</span>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-taxonomy-title]' ne '[wpv-taxonomy-slug]' )"]
<span class="alpha-font">[wpv-taxonomy-link]</span>
[/wpv-conditional]
</wpv-loop>
</div>
I hope that makes sense. Basically I just want to highlight the taxonomy choice for the page you are on.
Dear stephen,
It needs some custom codes, here is the detail steps:
1) Create a shortocode [is-tax] to check current page is the specific term's archive page, add below codes into your theme/functions.php:
function my_is_tax_func($atts, $content){
$args = shortcode_atts( array(
'term' => 0,
'tax' => 'category',
), $atts );
$res = 0;
$obj = get_queried_object();
if((isset($obj->term_id) && $obj->term_id == $args['term'])
&& (isset($obj->taxonomy) && $obj->taxonomy == $args['tax'])
){
$res = 1;
}
return $res;
}
add_shortcode( 'is-tax', 'my_is_tax_func');
2) Dashboard-> Toolset-> Settings
option "Third-party shortcode arguments", add the srhortcode name: is-tax
3) Use [is-tax] in the wpv-conditional shortcode, like this:
[wpv-conditional if="[is-tax term=[wpv-taxonomy-id] tax='category'] eq 1"]
<span class="alpha-font-active">[wpv-taxonomy-link]</span>
[/wpv-conditional]
[wpv-conditional if="[is-tax term=[wpv-taxonomy-id] tax='category'] ne 1"]
<span class="alpha-font">[wpv-taxonomy-link]</span>
[/wpv-conditional]
Please replace "category" with your custom taxonomy slug