Skip to main content
Expanding answer
Source Link

Wordpress does in fact add a current class by default:

check where it says:

<li id="menu-item-1688" class="current-menu-item">

Within your source code.

Now as for the other item, this is a bit tricky.

There is two ways to do it assuming that you need the last item for styling.

Option #1 is with pure CSS using the last-of-type selector.

Option #2, is using the get_wp_nav_menu as opposed to wp_nav_menu and once you are inside the foreach, you compare it using count and the current index of said foreach to add the css class dinamically.

Edit: If you are a bit new to Wordpress theming, I would definitely go with option number 1 despite not having full browser coverage.

Wordpress does in fact add a current class by default:

check where it says:

<li id="menu-item-1688" class="current-menu-item">

Within your source code.

Now as for the other item, this is a bit tricky.

There is two ways to do it assuming that you need the last item for styling.

Option #1 is with pure CSS using the last-of-type selector.

Option #2, is using the get_wp_nav_menu as opposed to wp_nav_menu and once you are inside the foreach, you compare it using count and the current index of said foreach to add the css class dinamically.

Wordpress does in fact add a current class by default:

check where it says:

<li id="menu-item-1688" class="current-menu-item">

Within your source code.

Now as for the other item, this is a bit tricky.

There is two ways to do it assuming that you need the last item for styling.

Option #1 is with pure CSS using the last-of-type selector.

Option #2, is using the get_wp_nav_menu as opposed to wp_nav_menu and once you are inside the foreach, you compare it using count and the current index of said foreach to add the css class dinamically.

Edit: If you are a bit new to Wordpress theming, I would definitely go with option number 1 despite not having full browser coverage.

Source Link

Wordpress does in fact add a current class by default:

check where it says:

<li id="menu-item-1688" class="current-menu-item">

Within your source code.

Now as for the other item, this is a bit tricky.

There is two ways to do it assuming that you need the last item for styling.

Option #1 is with pure CSS using the last-of-type selector.

Option #2, is using the get_wp_nav_menu as opposed to wp_nav_menu and once you are inside the foreach, you compare it using count and the current index of said foreach to add the css class dinamically.