[wp-hackers] Post ID using 'the_title' in the Latest Activity box

Henrik Melin henrikmelin at yahoo.com
Fri Jan 25 20:48:15 GMT 2008


Isn't that is essentially the same as &get_post, which works fine for the 'Recent Posts' bit, but not for 'Recent Comments'. For the comments, the id of the post is stored in $comment and is passed  as get_the_title($comment->comment_post_ID). So, I could make $comment global too, and get the ID from there, but there's not enough context to tell if we're looping through $posts or $comments. 

Does that make sense?

Henrik.

----- Original Message ----
From: Otto <otto at ottodestruct.com>
To: wp-hackers at lists.automattic.com
Sent: Friday, January 25, 2008 12:37:41 PM
Subject: Re: [wp-hackers] Post ID using 'the_title' in the Latest Activity box


Isn't $post a global at that point?

global $post;
$id = $post->ID;

That should work.


On Jan 25, 2008 2:11 PM, Henrik Melin <henrikmelin at yahoo.com> wrote:
> Hi,
>
> I'm replacing the title of a post to be a combination of two custom
 fields if they are present, e.g. artist "title". Generally, it is
 possible to get the id in the 'the_title' hook by:
>
>         $post = &get_post();
>         $id = $post->ID;
>
> Now, this does not work on the Latest Activity box on the Dashboard
 (2.3.2) -- does anyone know how to (always) get the id of the post that
 the_title() or get_the_title() refers to using the 'the_title' action?
 Seems to me like there isn't enough context for this action.
>
> Cheers,
> Henrik.
>
>
>
>
>      
 ____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page.
> http://www.yahoo.com/r/hs
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers





      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 



More information about the wp-hackers mailing list