开发者 | roytanck |
---|---|
更新时间 | 2024年7月5日 19:31 |
捐献地址: | 去捐款 |
PHP版本: | 3.5.2 及以上 |
WordPress版本: | 6.6 |
版权: | GPLv3 |
wp_list_pages
, and removes pages from the generated list that are not part of the
current navigation path. This creates an accordion navigation effect, and is an alternative approach to the CSS-based
way suggested in the Codex.
By removing unneeded HTML elements server-side, page size is reduced, and client-side rendering will usually be faster.
This is especially true for older browsers, and sites with a large number of published pages.
This plugin is intended to be used with the "pages" widget that comes with WordPress, or any navigation element that uses
wp_list_pages.
There are two ways the plugin can apply the filter.
rt-filter-page-list
to the /wp-content/plugins/
directoryIf you plan on using the Pages widget that comes with WordPress, it's probably best to filter just the output of that
widget by selecting 'Modify the behavior of the Pages widget'.
If you're building your own navigation based on wp_list_pages, select 'Modify wp_list_pages globally'. This will filter
the page list anywhere wp_list_pages is called. This could lead to unexpected behavior with menus and other widgets. If
this happens on your site, you can either opt to use the Pages widget, select 'None'.
Selecting 'None' disables the plugin's automatic filters, but still allows you to call the
RT_Filter_Page_List::filter_html function directly to apply filtering in your code.
$html = wp_list_pages( $args ); $html = RT_Filter_Page_List::filter_html( $html );
This is meant for cases where the pages menu contains a large number of pages, or where the target browser is slow (e.g. IE7/8). Or both. This plugin can reduce the pages listing returned by WordPress by up to 99%.
Since the filtering is done server-side, your site's pages might take slightly longer to generate. However, they will probably also be smaller (in terms of file size), and thus take less time to download. On sites where pages are cached, the effect should be negligable.
This plugin does not include CSS styles to highlight the currently selected page, its ancestors, or it children. Ideally, your theme should take care of this.