[wp-trac] [WordPress Trac] #9487: $post->post_type = 'page' ignored

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 8 12:32:27 GMT 2009


#9487: $post->post_type = 'page' ignored
--------------------------+-------------------------------------------------
 Reporter:  rjharv        |       Owner:  anonymous 
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:            
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 Hi all,

 This is odd and I've been chasing the bug around, and can't find it.

 I have this code in a plugin which tags meta data arround the_title();
 However I only want to do this for posts not pages hence if($type ==
 'post') {.......... in the code below.

 However anything returned from wp_list_pages() inherits the first real
 posts $post properties including $post->post_type = 'page'!!!


 add_filter('the_title', array(&$this, 'extend_the_title'));

 function extend_the_title($title = '') {
 global $post;
 $about = get_permalink($post->ID);
 $type = $post->post_type;
 if($type == 'post') {
  return '<span rel="'.$about.'" property="dc:title"
 resource="'.$about.'">'.$title.'</span>';
 }
 else {
  return $title;
 }
 }

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9487>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list