Home > PHP, Wordpress > WordPress/custom Http Headers

WordPress/custom Http Headers

June 16th, 2009

We need a quick WordPress plugin to do the following:

Use the ‘send_headers’ action to add HTTP headers on WordPress posts based on the modified date of the post.

So the plugin should work like this pseudcode:

add_action(‘send_headers’, ‘add_my_custom_headers’);
function add_my_custom_headers() {

// CODE TO MAKE SURE THIS IS A POST

if ( POST IS TODAY ) {
header(“x-test-current-date: Today”);
}
elsif ( POST IS YESTERDAY ) {
header(“x-test-current-date: YESTERDAY”);
}
elsif ( POST LAST UPDATED BEFORE YESTERDAY ) {
header(“x-test-current-date: OLD”);
}
elsif ( POST LAST UPDATED BEFORE A WEEK AGO ) {
header(“x-test-current-date: REALLY OLD”);
}
else {
header(“x-test-post-date: ANCIENT”);
}

}

We’ll figure out how to finish it and what headers we want to use, we just need someone to create the functional shell to do the date calcs and the appropriate logic.


Wordpress/custom Http Headers

Comments are closed.
Bear