In relation to question posted here, is it possible to have an output to have something like this instead? where class="parent"
is applied to the hyperlink?
<ul>
<li><a href="#">Page 1</a></li>
<li><a class="parent" href="#">Page with Subpages</a>
<ul class="children">
<li><a class="parent" href="#">Page with another subpage</a>
<ul class="children">
<li><a href="#">subsubpage</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Page 3</a></li>
<li><a href="#">Page 4</a></li>
</ul>
the function below of TheDeadMedic works well for lists:
function add_parent_class( $css_class, $page, $depth, $args )
{
if ( ! empty( $args['has_children'] ) )
$css_class[] = 'parent';
return $css_class;
}
add_filter( 'page_css_class', 'add_parent_class', 10, 4 );
is it possible to use a similar function to target hyperlinks instead of the lists?