开发者

wp_list_pages adding title to LI class

is there a way to add the Link page title to the LI class? I am trying to generate the navigation using wp_list_pages and would like each link to have its page title 开发者_运维问答in the LI class next to page-item. I have to style each li individually for background image hover.

Been searching but no luck =(


Not out of the box. However, it does auto inject the unique page-id into the class. Per the documementation for wp_list_pages()

All list items (li) generated by wp_list_pages() are marked with the class page_item. When wp_list_pages() is called while displaying a Page, the list item for that Page is given the additional class current_page_item.

It is possible use a filter for wp_list_pages() which may allow you to do what you want. But that may be overkill. I think the page-id should cut it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜