I am using the following code for a navigation bar on a WordPress website:
<?php wp_list_pages("title_li="); ?>
Which currently spits out some links that look like:
<a href="http://yoururl.com/?page_id=123">News</a>
What I'd like to do is have the ability to add an id to a link so that it looks like:
<a href="http://yoururl.com/?page_id=123" id="news">News</a>
Does anyone know how to do this? It's ok if just this page or every page has an id...whatever is easiest, I just need an ID so that I can target a specific link.
Thanks,
Josh
<li>
element.wp_list_pages
provides unique classes likepage-item-{id}
for those.page-item-' . $page->ID
. Adding id's is also possible, but you have to write a custom Walker class to get that.