Skip to content

Instantly share code, notes, and snippets.

@bordoni
Last active December 19, 2015 00:48
Show Gist options
  • Select an option

  • Save bordoni/5870829 to your computer and use it in GitHub Desktop.

Select an option

Save bordoni/5870829 to your computer and use it in GitHub Desktop.
<?php
add_filter('archive_template', function($located) {
$post_type = 'seu-post-type';
$template = plugin_dir_path(__FILE__) . "templates/archive-{$post_type}.php";
if (is_post_type_archive($post_type) && (empty($located) || preg_match("/archive.php$/", $located)) && file_exists($template)){
load_template( $template, true );
return $template;
}
return $located;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment