#9487 closed defect (bug) (invalid)
$post->post_type = 'page' ignored
Reported by: |
|
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)
Note: See
TracTickets for help on using
tickets.
that is what in_the_loop() is for