Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#9487 closed defect (bug) (invalid)

$post->post_type = 'page' ignored

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

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
18 years ago

  • Cc rjharv added

#2 @Denis-de-Bernardy
18 years ago

  • Resolution → invalid
  • Status new → closed

that is what in_the_loop() is for

#3 @Denis-de-Bernardy
17 years ago

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