Sub-page hierarchy, show pages on default menu. TODO: Ping Michael about top-level pages in kubrick menu.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
21f5e3f715
commit
373276ee25
|
@ -127,7 +127,41 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
|
|||
<td>$count</td>
|
||||
<td>$edit</td>
|
||||
</tr>";
|
||||
cat_rows($category->cat_ID, $level + 1);
|
||||
cat_rows($category->cat_ID, $level + 1, $categories);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function page_rows( $parent = 0, $level = 0, $pages = 0 ) {
|
||||
global $wpdb, $class, $user_level, $post;
|
||||
if (!$pages)
|
||||
$pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order");
|
||||
|
||||
if ($pages) {
|
||||
foreach ($pages as $post) { start_wp();
|
||||
if ($post->post_parent == $parent) {
|
||||
$post->post_title = wp_specialchars($post->post_title);
|
||||
$pad = str_repeat('— ', $level);
|
||||
$id = $post->ID;
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
?>
|
||||
<tr class='<?php echo $class; ?>'>
|
||||
<th scope="row"><?php echo $post->ID; ?></th>
|
||||
<td>
|
||||
<?php echo $pad; ?><?php the_title() ?>
|
||||
</td>
|
||||
<td><?php the_author() ?></td>
|
||||
<td><?php the_time('Y-m-d g:i a'); ?></td>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
|
||||
<td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||
<td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), the_title('','',0)) . "')\">" . __('Delete') . "</a>"; } ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
page_rows($id, $level + 1, $pages);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -29,23 +29,7 @@ if ($posts) {
|
|||
<th scope="col"></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
<?php
|
||||
$bgcolor = '';
|
||||
foreach ($posts as $post) : start_wp();
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
?>
|
||||
<tr class='<?php echo $class; ?>'>
|
||||
<th scope="row"><?php echo $id ?></th>
|
||||
<td>
|
||||
<?php the_title() ?>
|
||||
</td>
|
||||
<td><?php the_author() ?></td>
|
||||
<td><?php the_time('Y-m-d g:i a'); ?></td>
|
||||
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
|
||||
<td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
||||
<td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), the_title('','',0)) . "')\">" . __('Delete') . "</a>"; } ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php page_rows(); ?>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
|
|
|
@ -49,6 +49,7 @@ function the_title_rss() {
|
|||
function get_the_title($id = 0) {
|
||||
global $post, $wpdb;
|
||||
$title = $post->post_title;
|
||||
|
||||
if ( 0 != $id )
|
||||
$title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $id");
|
||||
|
||||
|
@ -365,10 +366,15 @@ function wp_list_pages($args = '') {
|
|||
if (!isset($r['depth'])) $r['depth'] = 0;
|
||||
if (!isset($r['show_date'])) $r['show_date'] = '';
|
||||
if (!isset($r['child_of'])) $r['child_of'] = 0;
|
||||
if ( !isset($r['title_li']) ) $r['title_li'] = __('Pages');
|
||||
|
||||
|
||||
// Query pages.
|
||||
$pages = get_pages($args);
|
||||
if ( $pages ) :
|
||||
|
||||
if ( $r['title_li'] )
|
||||
echo '<li>' . $r['title_li'] . '<ul>';
|
||||
// Now loop over all pages that were selected
|
||||
$page_tree = Array();
|
||||
foreach($pages as $page) {
|
||||
|
@ -397,6 +403,9 @@ function wp_list_pages($args = '') {
|
|||
// Output of the pages starting with child_of as the root ID.
|
||||
// child_of defaults to 0 if not supplied in the query.
|
||||
_page_level_out($r['child_of'],$page_tree, $r);
|
||||
if ( $r['title_li'] )
|
||||
echo '</ul></li>';
|
||||
endif;
|
||||
}
|
||||
|
||||
function _page_level_out($parent, $page_tree, $args, $depth = 0) {
|
||||
|
|
|
@ -228,7 +228,7 @@ ul.post-meta span.post-meta-key {
|
|||
|
||||
#menu ul ul li {
|
||||
border: 0;
|
||||
font: normal normal 70%/115% 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
||||
font: normal normal 12px/115% 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
||||
letter-spacing: 0;
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<div id="menu">
|
||||
|
||||
<ul>
|
||||
<?php wp_list_pages(); ?>
|
||||
<?php get_links_list(); ?>
|
||||
<li id="categories"><?php _e('Categories:'); ?>
|
||||
<ul>
|
||||
|
|
Loading…
Reference in New Issue