Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Created February 15, 2020 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betweenbrain/40142f047a0ab4968de50ddf53f6e5d7 to your computer and use it in GitHub Desktop.
Save betweenbrain/40142f047a0ab4968de50ddf53f6e5d7 to your computer and use it in GitHub Desktop.
WordPress load template part based on request (pseudo code)
global $wp;
$current_url = add_query_arg( array(), $wp->request );
// echo '<pre>' . print_r($wp->request, true) . '</pre>';
// Add logic here:
$load = locate_template( 'archive-activity.php', true );
if ( $load ) {
// just exit if template was found and loaded
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment