Last active
February 1, 2018 05:12
-
-
Save kamalinfo/4a10ca19530d5051e1ed8402ae7f35ed to your computer and use it in GitHub Desktop.
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 themeName_get_the_id(){ | |
if(is_woocommerce()){ | |
$id = get_option( 'woocommerce_shop_page_id' ); | |
} elseif(is_home() && !is_front_page()){ | |
$id = get_option( 'page_for_posts' ); | |
} else { | |
$id = get_the_id(); | |
} | |
return $id; | |
} | |
//another page another header style | |
function ThemeName_get_the_id(){ | |
if(is_woocommerce()){ | |
$id = get_option( 'woocommerce_shop_page_id' ); | |
} elseif(is_home() && !is_front_page()){ | |
$id = get_option( 'page_for_posts' ); | |
} else { | |
$id = get_the_id(); | |
} | |
return $id; | |
} | |
$menu_style_meatbox = get_post_meta(ThemeName_get_the_id(),'_ThemeName_page_menu_style',true); | |
$menu_style_theme_option = $ThemeName_opt ['ThemeName_header_layout']; | |
if( $menu_style_meatbox!='none'){ | |
$menu_style_theme_option = $menu_style_meatbox; | |
} | |
switch( $menu_style_theme_option ){ | |
case 2: | |
get_template_part('/inc/header/header-2'); | |
break; | |
case 3: | |
get_template_part('/inc/header/header-3'); | |
break; | |
case 4: | |
get_template_part('/inc/header/header-4'); | |
break; | |
default: | |
get_template_part('/inc/header/header-1'); | |
} | |
//blog style | |
if( isset ( $themename_opt['themename_sidebarblog_pos'] ) ){ | |
$themename_blog_layout_opts = $themename_opt['themename_sidebarblog_pos']; | |
} | |
if(isset($_GET['layout'])){ | |
switch (htmlspecialchars($_GET['layout'])) { | |
case 'twocolumn': | |
$themename_blog_layout_opts = 'twocolumn'; | |
break; | |
case 'threecolumn': | |
$themename_blog_layout_opts = 'threecolumn'; | |
break; | |
case 'left_sidebar': | |
$themename_blog_layout_opts = 'left'; | |
break; | |
case 'right_sidebar': | |
$themename_blog_layout_opts = 'right'; | |
break; | |
default: | |
$themename_blog_layout_opts = 'single'; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment