Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9487 closed defect (bug) (invalid)

$post->post_type = 'page' ignored

Reported by: rjharv's profile rjharv Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

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;

}
}

Change History (3)

#1 @rjharv
16 years ago

  • Cc rjharv added

#2 @Denis-de-Bernardy
16 years ago

  • Resolution set to invalid
  • Status changed from new to closed

that is what in_the_loop() is for

#3 @Denis-de-Bernardy
16 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.