#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;
}
}
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
that is what in_the_loop() is for