Last active
October 22, 2015 19:50
-
-
Save obiPlabon/da41ed152c2f0c6bae57 to your computer and use it in GitHub Desktop.
Built in function and it's pretty helpful to understand WP global variable
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 load_template( $_template_file, $require_once = true ) { | |
| global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; | |
| if ( is_array( $wp_query->query_vars ) ) { | |
| extract( $wp_query->query_vars, EXTR_SKIP ); | |
| } | |
| if ( isset( $s ) ) { | |
| $s = esc_attr( $s ); | |
| } | |
| if ( $require_once ) { | |
| require_once( $_template_file ); | |
| } else { | |
| require( $_template_file ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment