Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Created February 15, 2020 00:39
Show Gist options
  • 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