外掛說明
This plugin adds classes or IDs (your choice) to the LI
tags generated by WordPress’ wp_list_pages()
and wp_nav_menu()
functions.
I found it very frustrating to style the output of these menus without having access to these attributes. This plugin allows you to style the output of wp_list_pages()
and wp_nav_menu()
with CSS.
The class name or ID is derived from the URL of the page.
For example,
/about/
could have the classabout
./about/faq/
could have the classabout_faq
.
If a page does not have a URL (e.g. your front page) the plugin will set the class
or id
(depending on what you selected) to frontpage
, adding whatever prefix you requested.
For example,
/
could have the classpg_frontpage
.
Existing classes (e.g. page_item
or current
) are left untouched.
Sample output
<li id="nav-a-new-page" class="first page_item page-item-4"><a href="http://example.com/a-new-page/" title="A new page">A new page</a></li>
<li id="nav-about" class="page_item page-item-2"><a href="http://example.com/about/" title="About">About</a></li>
<li id="nav-another-new-page" class="last page_item page-item-6"><a href="http://example.com/another-new-page/" title="Another new page">Another new page</a></li>
Configuration
Using the Classy wp_list_pages
tab in the options panel you can choose whether you want to use IDs or classes, set the token separator and add an optional token prefix.
You can also specify a class to add to the first and last items in a list.
Pretty straight forward…
Contact and Credits
Written by Alex Dunae ( dunae.ca ), e-mail ‘code’ at the same domain), 2007-09.
安裝方式
- Unzip
classy_wp_list_pages.zip
in your/wp-content/plugins/
directory. - Activate the plugin through the ‘Plugins’ menu in WordPress.
- Navigate the the
Classy wp_list_pages
tab in the options panel to configure the plugin.
使用者評論
這個外掛目前沒有任何使用者評論。
參與者及開發者
變更記錄
1.4.0
- Add support for wp_nav_menu()
- Fix frontpage support
1.3.2
- Fixed
register_setting
process (thanks to simplistik in the forums). - Fixes to the way the
last
class is applied (thanks to deanoakley in the forums).
1.3.1
- Fixed bug with nested pages and the
last
class (thanks to iron77 in the forums). - Added uninstall script (thanks to Casemon in the forums).
1.3
- Ability to specify a class to add to the first and list items in a list.
- Fixed EOL regex in ‘last’ class regexp.
1.2.2
siteurl
bug fix (thanks to Joen Asmussen for the bug report).
1.2.1
- Changed
get_option('siteurl')
toget_option('home')
.
1.2
- Updated options handle for WP 2.7.
1.1.1
- Added fallback identifier for pages without URLs (thanks to Dave Penfold for the bug report).
1.1
- Added support for IDs and custom prefixes and separators.
1.0
- Initial version.