Created
July 9, 2012 02:52
-
-
Save pedroelsner/3073937 to your computer and use it in GitHub Desktop.
#6 - Rewrite WordPress
This file contains hidden or 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 | |
| function my_template_redirect() { | |
| global $wpdb; | |
| global $wp_query; | |
| global $current_user; | |
| if ($wp_query->get('custom_page') == 'contato') { | |
| // Definimos o título da página | |
| add_filter('wp_title', create_function('$a', 'return "Contato «";'), 100); | |
| if (file_exists(TEMPLATEPATH . '/tpl-contato.php')) { | |
| include(TEMPLATEPATH . '/tpl-contato.php'); | |
| } else { | |
| echo "Erro: Arquivo 'tpl-contato.php' não foi encontrado."; | |
| } | |
| exit(); | |
| } | |
| } | |
| add_action('template_redirect', 'my_template_redirect'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment