get_queried_object(); if ( !in_array( $object->name, layers_get_standard_wp_post_types() ) ) { $templates = array( 'author.php'); $template = layers_locate_plugin_templates($templates); } // return apply_filters('author_template', $template); return $template; } } // layers_get_custom_author_template add_filter( 'author_template', 'layers_get_custom_author_template' ); /** * Get Custom Archive Template * * This force-adds our custom post type templates to the list of templates to search for, eg. archive-portfolio.php * * @param string $template Name of the template file we're looking for */ if ( !function_exists( 'layers_get_custom_archive_template' ) ) { function layers_get_custom_archive_template($template) { global $wp_query; $object = $wp_query->get_queried_object(); if ( is_object( $object ) && !in_array( $object->name, layers_get_standard_wp_post_types() ) ) { $templates = array('archive-' . $object->name . '.php', 'archive.php'); $template = layers_locate_plugin_templates($templates); } // return apply_filters('archive_template', $template); return $template; } } // layers_get_custom_archive_template add_filter( 'archive_template', 'layers_get_custom_archive_template' ); /** * Get Custom Single Template * * This force-adds our custom post type templates to the list of templates to search for, eg. single-portfolio.php * * @param string $template Name of the template file we're looking for */ if ( !function_exists( 'layers_get_custom_single_template' ) ) { function layers_get_custom_single_template($template) { global $wp_query; $object = $wp_query->get_queried_object(); if ( !in_array( $object->post_type, layers_get_standard_wp_post_types() ) ) { $templates = array('single-' . $object->post_type . '.php', 'single.php'); $template = layers_locate_plugin_templates($templates); } // return apply_filters('single_template', $template); return $template; } } // layers_get_custom_single_template add_filter( 'single_template', 'layers_get_custom_single_template' ); /** * Get Custom Taxonomy Template * * This force-adds our custom taxonomy templates to the list of templates to search for, eg. taxonomy-portfolio-categry.php * * @param string $template Name of the template file we're looking for */ if ( !function_exists( 'layers_get_custom_taxonomy_template' ) ) { function layers_get_custom_taxonomy_template($template) { // Setup the taxonomy we're looking for $taxonomy = get_query_var('taxonomy'); if ( !in_array( $taxonomy, layers_get_standard_wp_taxonomies() ) ) { $term = get_query_var('term'); $templates = array(); if ( $taxonomy && $term ) $templates[] = "taxonomy-$taxonomy-$term.php"; if ( $taxonomy ) $templates[] = "taxonomy-$taxonomy.php"; $templates[] = "taxonomy.php"; $template = layers_locate_plugin_templates($templates); } // return apply_filters('taxonomy_template', $template); return $template; } } // layers_get_custom_taxonomy_template add_filter( 'taxonomy_template', 'layers_get_custom_taxonomy_template' ); //@TODO: Cleanup this code if( !function_exists( 'layers_get_plugins') ) { function layers_get_plugins(){ $active_plugins = wp_get_active_and_valid_plugins(); $layers_plugins = array(); foreach ( (array) $active_plugins as $plugin_key ) { $plugin_data = get_plugin_data( $plugin_key ); if( isset( $plugin_data[ 'Layers Plugin' ] ) && 'true' == strtolower( $plugin_data[ 'Layers Plugin' ] ) ){ $layers_plugins[ $plugin_key ] = $plugin_data; } } return $layers_plugins; } } // layers_get_plugins if( !function_exists( 'layers_plugin_headers') ) { function layers_plugin_headers( $extra_headers ) { $extra_headers[] = 'Layers Plugin'; $extra_headers[] = 'Layers Required Version'; return $extra_headers; } } // layers_get_plugins add_filter( 'extra_plugin_headers', 'layers_plugin_headers' );