Wordpress Autocycler

0xfefefe

Newbie
Joined
Nov 5, 2008
Messages
13
Reaction score
4
I am releasing a first of my wordpress plugins.

http://0xfefefe.info/wordpress-plugins/wordpress-autocycler/

Please tell me what you think. I know is basic, but I have been running it for a quite a long time now :)
 
Your first post and you want someone to download something? nah passs lol
 
It seems that post counter is broken. I have post in the shit list forum already today.
 
Thanks for posting this, 0xfefefe. I don't know if I'll get around to using it anytime soon, but when I do, I'll send you a PM. I love seeing people take guys like Eli seriously and develop tools like this.

Thanks.
 
It is small enough to post here. I am not here to play games.


PHP:
/**
 * Plugin Name: WP-Autocyler
 * Plugin URI: http://www.0xfefefe.info/     
 * Description: Checks post/page expiry time and possibly sets 301 redirect, using post meta.
 * Version: 0.1a
 * License: GPLv2 
 */
 
/**
 * Load WP-Config file if this file is called directly
 */
if (!function_exists('add_action')) {
        include_once('../../../wp-config.php');
}

add_action('get_header','autocycler');
function autocycler() {
        if ( is_home() || is_category() || is_archive() || is_tag() ) return;

        $post_id = url_to_postid($_SERVER['REQUEST_URI']);
        $post_expire = get_post_meta($post_id, 'post_expiry', true);
        if ($post_expire) {
                $now = time(); 
                if ($now > $post_expire) {
                        $redirect_url = get_post_meta($post_id, 'redirect_url', true);
                        header("HTTP/1.1 301 Moved Permanently");
                        header("Location: " . $redirect_url);
                        exit();
                }
        }
}

?>
 
good job, thanks for your working, hope you will get more what you want
 
actually this is helpful.
with a bit play between a autoblog + re-writer the plugin can help
pull in traffic to your leads like crazy

*thanks*
 
what's post/page expiry time ?

When you make a post to wordpress there is the option to set "Custom Fields."

Here is an image showing this (found via goog):
custom-fields.gif



Make two custom fields - One called "post_expiry" and another called "redirect_url" (whithout the quotes, of course)

The post_expiry field is in UNIX Epoch format - or number of seconds from 00:00:00 UTC on January 1st, 1970.
Meaning if you wanted a post to 'expire' (meaning 301 redirect) on Tue, 13 Jan 2009 16:57:39 GMT you would put 1231865859
as the value for this particular post's post_expiry.

The redirect_url is a complete URL - http://www.domain.com/sub-dir/subpage/whatever


Remember this is on a per post basis, so both post_expiry and redirect_url custom fields are required on any post (or page) that you want to expire.
 
Last edited:
hmm, tried it. works well but
can you do it in another time format epoch format is a bit confusing ;)
 
hmm, tried it. works well but
can you do it in another time format epoch format is a bit confusing ;)


Now that I have released wp-autocycler, I will put some time into making it a bit more user friendly. Unfortunately, I have one other non-im related project that has priority (i still have a damn day job, if u can call it that)

Also, PHP is not my strong point. I am a perl hacker from way back...
 
Back
Top