Skip to content

Instantly share code, notes, and snippets.

@JoshFialkoff
Created August 22, 2013 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JoshFialkoff/6312587 to your computer and use it in GitHub Desktop.
Save JoshFialkoff/6312587 to your computer and use it in GitHub Desktop.
This produces a 301 redirect based on an Advanced Custom Fields drop down list of site pages (or posts if you want). It works great with the Genesis Responsive Slider to allow editors to have a marketing message link to a product or service page.
/* redirect for slide pages */
add_action('template_redirect', 'slide_template_redirect', 1);
function slide_template_redirect(){
if ( in_category('homepage-slider') ) {
if(get_field('landing_page')){
wp_redirect( get_field('landing_page'), 301);
exit;
}
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment