Wordpress page grouping
Is there any way to group/folder my pages in Wordpress. Pages as in pages, not posts. In case I'm using it as a CMS and have, say, 200 pages. 10 main pages and the rest are all sub-pages. It'd be really inconvenient to see all the pages as a one huge lists.
I know I could use posts and categories, as I won't be needing the blog functionality anyway, and even if I did need it, I could make it work anyway. Thin开发者_如何学编程g is, I'd lose a bit functionality this way and it's unfortunately not an option for me.
I have looked around and Googled but so far with no results. I'm sure I'm not the only one who has come to wonder about that.
Ok, so I found exactly what I was looking for.
http://wordpress.org/extend/plugins/page-tree/
Do you have a WordPress site with lots of pages in a hierarchical structure? Are you trying to use WordPress like a "real" CMS? Then this plugin is for you! Page Tree gives you a much-needed overview of your pages in the admininstration panel using a common expand/collapse menu, which lets you navigate your page structure like a folder tree in Windows Explorer.
CMS Tree Page View is a plugin that I've created and I think it's what you've been looking for.
Some of it's features are:
- View and organize pages in a simple to use tree view
- Edit pages directly from the tree
- Add pages at any place in the tree
- Drag and drop to rearrange your pages
- Search pages
- See all pages – including private and drafts – or just publicly available pages
Screenshots, a screencast and download:
http://eskapism.se/code-playground/cms-tree-page-view/
If I understand what you are trying to do, this is supported in wordpress core since the page is able to have a subpages and so on.
More info about pages organization on the following link:
http://codex.wordpress.org/Pages#Organizing_Your_Pages
Maybe WordPress › pageMash > Page Management « WordPress Plugins?
Try this:
<?php
global $post; $current_page_parent = ( $post->post_parent ? $post->post_parent : $post->ID );
$mypages = get_pages( array (
'sort_order' => 'ASC',
'sort_column' => 'post_title',
'hierarchical' => 1,
'child_of' => $current_page_parent,
'number' => 5,
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish' ) );
?><ul class="sibling-page-list">
<li class="page-text">Page: </li>
<?php
$iPage = 0;
foreach( $mypages as $page ) {
$iPage++;
// this is to show a highlight of the page you're on.
if ($post->ID == $page->ID) {$active = "active";} else {$active = "";}
?>
<li class="sibling-page-link <?php echo $active; ?>">
<a href="<?php echo get_page_link( $page->ID ); ?>" title="<?php echo $page->post_title; ?>"><?php echo $iPage; ?></a>
</li>
<?php
}
?>
</ul>
My stylesheet classes are:
.sibling-page-list {
margin: 0;
padding: 0;
list-style: none;
height: 20px;
}
.sibling-page-list li {
float: left;
display: block;
margin-right: 10px;
}
.sibling-page-list li.sibling-page-link.active {
background: #eee;
}
I'll be making a plugin to facilitate this solution since I've had the need for it for quite some time now.
Special thanks to this post: http://wordpress.org/support/topic/list-only-page-siblings which got me started on the top part. The pagination, I added. Also, will be working on how many pages to show, etc... Enjoy modifying it.
Oh, BTW, place this code above in your Page Template file for it to work on pages.
精彩评论