0

I appreciate your time in looking into this for me.

I'm using wp_list_categories tag to display a list of categories in my navigation menu and I'd like to disable the link to the current category when viewing said category page.

My main reason is that the color attribute in my CSS style for li.cat-item a is overriding the color attribute for my CSS style for .current-category a and blocking my attempts to create a contrasting text color for the current category item.

  • I was able to disable the link by adding pointer-events: none; cursor: default; to .current-category a and then I solved the link color override by simply adding li to .current-category a. – rfel00 Aug 9 '14 at 5:11
0

You can use get_the_category(); to display your category in menu

<?php
    $categories = get_the_category();
    $separator = ' ';
    $output = '';
    if($categories){
        foreach($categories as $category) {

    $output .= '<a " href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator;
        }
    echo trim($output, $separator);
    }
?>  

I used the <a> tag you can remove it for link. I Hope it help you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.