[wp-cvs] wordpress/wp-includes functions.php,1.181,1.182
Ryan Boren
rboren at users.sourceforge.net
Wed Oct 6 05:11:23 UTC 2004
- Previous message: [wp-cvs] wordpress/wp-admin admin-functions.php, 1.46,
1.47 edit-page-form.php, 1.6, 1.7 edit-pages.php, 1.4,
1.5 post.php, 1.89, 1.90
- Next message: [wp-cvs] wordpress/wp-includes functions-user.php,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16932/wp-includes
Modified Files:
functions.php
Log Message:
Page templates.
Index: functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions.php,v
retrieving revision 1.181
retrieving revision 1.182
diff -C2 -d -r1.181 -r1.182
*** functions.php 6 Oct 2004 02:18:37 -0000 1.181
--- functions.php 6 Oct 2004 05:11:11 -0000 1.182
***************
*** 448,456 ****
}
! function get_post_meta($post_id, $key) {
global $wpdb, $post_meta_cache;
if (isset($post_meta_cache[$post_id][$key])) {
! return $post_meta_cache[$post_id][$key];
}
--- 448,460 ----
}
! function get_post_meta($post_id, $key, $single = false) {
global $wpdb, $post_meta_cache;
if (isset($post_meta_cache[$post_id][$key])) {
! if ($single) {
! return $post_meta_cache[$post_id][$key][0];
! } else {
! return $post_meta_cache[$post_id][$key];
! }
}
***************
*** 464,468 ****
}
! return $values;
}
--- 468,480 ----
}
! if ($single) {
! if (count($values)) {
! return $values[0];
! } else {
! return '';
! }
! } else {
! return $values;
! }
}
***************
*** 470,473 ****
--- 482,490 ----
global $wpdb, $post_meta_cache;
+ if(! $wpdb->get_var("SELECT meta_key FROM $wpdb->postmeta WHERE meta_key
+ = '$key' AND post_id = '$post_id'") ) {
+ return false;
+ }
+
if (empty($prev_value)) {
$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE
***************
*** 1821,1824 ****
--- 1838,1861 ----
}
+ function get_page_template() {
+ global $wp_query;
+
+ $id = $wp_query->post->ID;
+ $template_dir = get_template_directory();
+ $default = "$template_dir/page.php";
+
+ $template = get_post_meta($id, '_wp_page_template', true);
+
+ if (empty($template) || ($template == 'default')) {
+ return $default;
+ }
+
+ if (file_exists("$template_dir/$template")) {
+ return "$template_dir/$template";
+ }
+
+ return $default;
+ }
+
// Borrowed from the PHP Manual user notes. Convert entities, while
// preserving already-encoded entities:
- Previous message: [wp-cvs] wordpress/wp-admin admin-functions.php, 1.46,
1.47 edit-page-form.php, 1.6, 1.7 edit-pages.php, 1.4,
1.5 post.php, 1.89, 1.90
- Next message: [wp-cvs] wordpress/wp-includes functions-user.php,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cvs
mailing list