Herzlich willkommen im SEO Forum der ABAKUS Internet Marketing GmbH
registrieren registriertes Mitglied
Code: Alles auswählen
<?php
/*
Plugin Name: Henks Redirect
Plugin URI:
Description:
Version: Eraly Access Alpha for only $9,999.99 or free
Author:
Author URI:
Released under the WTF Public License 2.0 (WTFPL2.0)
http://www.wtfpl.net/about/
*/
function henks_redirect() {
if(is_single()) {
$id = get_the_ID();
$dat3 = get_post_meta($id, 'date', true);
$target = get_post_meta($id, 'target', true);
if( $dat3 != '' && $target != '') {
$d = strtotime( $dat3 );
if ($d < time()) {
wp_redirect($target, 303 );
exit;
}
}
}
}
add_action( 'the_post', 'henks_redirect');
?>
Code: Alles auswählen
function henks_shortcode($atts) {
if (is_single() || is_page()) {
extract(shortcode_atts(array(
'date' => '',
'target' => 'http://example.com', //Default URL
'status' => '303' //Default Status DONT use 404
), $atts));
if ( $date != '') {
$d = strtotime ( $date );
if ($d < time()) {
wp_redirect( $target, $status);
exit;
}
}
}
}
add_shortcode('henk', 'henks_shortcode');