Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function taxonomy_term_archve_rewrite_rules() {
- add_rewrite_rule( '(.+)/?$', 'index.php?taxonomy=$matches[1]', 'top' );
- }
- add_action( 'init', 'taxonomy_term_archve_rewrite_rules' );
- function taxonomy_term_archive_template( $template ) {
- global $wp_query;
- // Check if the query_var taxonomy is set
- if ( isset( $wp_query->query_vars['taxonomy'] ) ) {
- // Custom template file in my theme
- $taxonomy_term_archive_template = TEMPLATEPATH . '/templates/taxonomy-term-archive.php';
- // Return the template file
- if ( file_exists( $taxonomy_term_archive_template ) ) {
- $file_headers = @get_headers( $taxonomy_term_archive_template );
- if ( $file_headers[0] != 'HTTP/1.0 404 Not Found' ) {
- return $taxonomy_term_archive_template;
- }
- }
- }
- return $template;
- }
- add_filter( 'template_include', 'taxonomy_term_archive_template' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement