WordPress Current Page .current_page_item


/ Published in: PHP
Save to your folder(s)

Better way to echo a .current_page_item class on a list nav.


Copy this code and paste it in your HTML
  1. <ul><li <?php if (is_page($post->ID)) { echo'class="current_page_item"'; } ?>>Menu Item 1</li></ul>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.