Skip to content

Instantly share code, notes, and snippets.

@yllus
Created January 19, 2015 19:30
Show Gist options
  • Select an option

  • Save yllus/ebb21174e273efa4083a to your computer and use it in GitHub Desktop.

Select an option

Save yllus/ebb21174e273efa4083a to your computer and use it in GitHub Desktop.
Display a custom page template/view if a "rssa" GET parameter is placed in a post's URL
// If the query parameter is passed, use a different article template than the usual
// (this one has no header/footer).
function rssa_content_mobile_view() {
if ( isset( $_GET['rssa'] ) && is_singular() ) {
require '/some-path/article/view.article.mobile-view.php';
exit;
}
}
add_action( 'template_redirect', 'rssa_content_mobile_view' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment