Fix post/page slug out. Props donncha. fixes #2472

git-svn-id: http://svn.automattic.com/wordpress/trunk@3558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-02-20 17:13:06 +00:00
parent 2fc8c248b3
commit 605d4a617a
2 changed files with 5 additions and 2 deletions

View File

@ -675,7 +675,7 @@ function get_page_by_path($page_path) {
foreach($page_paths as $pathdir) foreach($page_paths as $pathdir)
$full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
$pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path'"); $pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path' AND post_type='page'");
if ( empty($pages) ) if ( empty($pages) )
return 0; return 0;
@ -684,7 +684,7 @@ function get_page_by_path($page_path) {
$path = '/' . $leaf_path; $path = '/' . $leaf_path;
$curpage = $page; $curpage = $page;
while ($curpage->post_parent != 0) { while ($curpage->post_parent != 0) {
$curpage = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$curpage->post_parent'"); $curpage = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$curpage->post_parent' and post_type='page'");
$path = '/' . $curpage->post_name . $path; $path = '/' . $curpage->post_name . $path;
} }

View File

@ -258,6 +258,9 @@ function the_meta() {
if ( $keys = get_post_custom_keys() ) { if ( $keys = get_post_custom_keys() ) {
echo "<ul class='post-meta'>\n"; echo "<ul class='post-meta'>\n";
foreach ( $keys as $key ) { foreach ( $keys as $key ) {
$keyt = trim($key);
if ( '_' == $keyt{0} )
continue;
$values = array_map('trim', get_post_custom_values($key)); $values = array_map('trim', get_post_custom_values($key));
$value = implode($values,', '); $value = implode($values,', ');
echo "<li><span class='post-meta-key'>$key:</span> $value</li>\n"; echo "<li><span class='post-meta-key'>$key:</span> $value</li>\n";