-
-
Save azharisubroto/3ee25b38eeea0a30cc906954a90e6855 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