Created
March 29, 2017 16:35
-
-
Save leobaiano/167229fedbb2271e97e5c3d2bf9766e4 to your computer and use it in GitHub Desktop.
Template do single.php de acordo com a categoria do post acessado
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $post; | |
$categorias_do_post = get_the_category( $post->ID ); | |
if ( file_exists( 'diretorio_com_templates/template-' . $categorias_do_post[0]->slug . '.php' ) { | |
require 'diretorio_com_templates/template-' . $categorias_do_post[0]->slug . '.php'; | |
} else { | |
require 'diretorio_com_templates/template-default.php'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment