Created
September 13, 2016 10:51
-
-
Save anonymous/c1eb945c40060dd861506c28fbf2e482 to your computer and use it in GitHub Desktop.
Query Args
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 | |
function themeslug_query_vars( $qvars ) { | |
$vars[] = 'headertype'; | |
return $vars; | |
} | |
add_filter( 'query_vars', 'themeslug_query_vars' , 10, 1 ); |
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 | |
$headernumb = get_query_var( 'headertype' ); | |
// Kalo query_var ada, jadi prioritas | |
if( $headernumb ){ | |
$headertype = $headernumb; | |
// Kalo query_var di browser url address gak ada, tarik dari theme option | |
} else { | |
$headertype = my_option('headertype', 3); | |
} | |
// tarik file: header-n.php | |
get_template_part('header', '$headertype'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment