Created
January 26, 2011 04:58
-
-
Save sproutventure/796249 to your computer and use it in GitHub Desktop.
latest deal redirect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function new_latest_deal_redirect( $redirect = null ) { | |
$latest_deal_qv = get_query_var( 'todays-deal' ); | |
$latest_deal = ( $latest_deal_qv != '' ) ? $latest_deal_qv : $_GET['todays-deal'] ; | |
// redirect from homepage if cookie is set or we are using the todays-deal link | |
if( 1 == $latest_deal || ( is_home() && isset( $_COOKIE[ 'your-selected-location' ] ) ) ) { | |
$redirect = get_gbs_latest_deal_link(); | |
} elseif ( is_home() && is_user_logged_in() ) { // redirect for logged in users | |
$redirect = get_gbs_deals_link(); | |
} | |
if ( $redirect != null ) { // if we have something to redirect to let's do it. | |
wp_redirect( apply_filters( 'latest_deal_redirect', $redirect ) ); | |
exit(); | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment