[wp-hackers] topic exchange integration

Tara Star tellme at climbtothestars.org
Sun Jul 18 21:23:21 UTC 2004


Luca Lizzeri wrote:

I'm going to ask silly questions here, as I don't really understand how 
plugins work.


> This is a proof of concept plugin that might work (untested, anyone
> wants to help ?) that should do the first part of what your are
> requesting (tra ckback) using a meta field named ite_topic.
> 
> <?
> function ite_trackback($post_ID) {
>     
>     $data = get_postdata($post_ID);
>     
>     // Get the keys and values of the custom fields:
>     $ite_topics = $post_meta_cache[$post_ID]['ite_topic'];
> 
>     // Generate the tags
>     if (count($ite_topics)) {
>         foreach ($ite_topics as $ite_topic)
>         	$ite_tb_urls[] = "http://topicexchange.com/t/". $ite_topic ;
>         
>         // Subtract ITE urls already pinged
>         $pinged = explode("\n", $data['pinged']);
>         $ite_tb_urls = arraydiff($ite_tb_urls, $pinged);
>         
>         foreach ($ite_tb_urls as $ite_tb_url)
>         	trackback($ite_tb_url, stripslashes($data['Title']),
> $data['Excerpt'], $post_ID);
>     }
>     
>     return $post_ID;
> }

function looks nice -- but now, where do I put it? in my-hacks.php?

> // Hook into the Plugin API
> add_action('publish_post', 'ite_trackback');

so this is the call to the function. I assume  it means that when a post 
is published, it will run the function above. Where should that line go?

Are we sure the function will run AFTER the meta fields are filled?

For displaying, we would need a function like the_category() 
(the_ite_channel()?) -- but I could also put something together with 
strings and tape that will display it correctly.

Steph



More information about the hackers mailing list