Advertisement
OlegZinchenko

header.php

Jun 26th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.88 KB | None | 0 0
  1. <?php
  2. /**
  3. * The Header for our theme.
  4. */
  5.  
  6. global $THEMEREX_GLOBALS;
  7.  
  8. // Theme init - don't remove next row! Load custom options
  9. themerex_core_init_theme();
  10.  
  11. $theme_skin = themerex_esc(themerex_get_custom_option('theme_skin'));
  12. $blog_style = themerex_get_custom_option(is_singular() && !themerex_get_global('blog_streampage') ? 'single_style' : 'blog_style');
  13. $body_style = themerex_get_custom_option('body_style');
  14. $logo_style = themerex_get_custom_option('top_panel_style');
  15. $article_style = themerex_get_custom_option('article_style');
  16. $top_panel_style = themerex_get_custom_option('top_panel_style');
  17. $top_panel_opacity = themerex_get_custom_option('top_panel_opacity');
  18. $top_panel_position = themerex_get_custom_option('top_panel_position');
  19. $video_bg_show = themerex_get_custom_option('show_video_bg')=='yes' && (themerex_get_custom_option('video_bg_youtube_code')!='' || themerex_get_custom_option('video_bg_url')!='');
  20. ?><!DOCTYPE html>
  21. <html <?php language_attributes(); ?>>
  22. <head>
  23. <meta charset="<?php bloginfo( 'charset' ); ?>" />
  24. <?php
  25. if (themerex_get_theme_option('responsive_layouts') == 'yes') {
  26. ?>
  27. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  28. <?php
  29. }
  30. if (floatval(get_bloginfo('version')) < "4.1") {
  31. ?>
  32. <title><?php wp_title( '|', true, 'right' ); ?></title>
  33. <?php
  34. }
  35. ?>
  36. <link rel="profile" href="http://gmpg.org/xfn/11" />
  37. <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
  38. <?php
  39. $favicon = themerex_get_custom_option('favicon');
  40. if (!$favicon) {
  41. if ( file_exists(themerex_get_file_dir('skins/'.($theme_skin).'/images/favicon.ico')) )
  42. $favicon = themerex_get_file_url('skins/'.($theme_skin).'/images/favicon.ico');
  43. if ( !$favicon && file_exists(themerex_get_file_dir('favicon.ico')) )
  44. $favicon = themerex_get_file_url('favicon.ico');
  45. }
  46. if ($favicon) {
  47. ?>
  48. <link rel="icon" type="image/x-icon" href="<?php echo esc_url($favicon); ?>" />
  49. <?php
  50. }
  51.  
  52. wp_head();
  53. ?>
  54. </head>
  55.  
  56. <?php
  57. $class = $style = '';
  58. if ($body_style=='boxed' || themerex_get_custom_option('load_bg_image')=='always') {
  59. $customizer = themerex_get_theme_option('show_theme_customizer') == 'yes';
  60. if ($customizer && ($img = (int) themerex_get_value_gpc('bg_image', 0)) > 0)
  61. $class = 'bg_image_'.($img);
  62. else if ($customizer && ($img = (int) themerex_get_value_gpc('bg_pattern', 0)) > 0)
  63. $class = 'bg_pattern_'.($img);
  64. else if ($customizer && ($img = themerex_get_value_gpc('bg_color', '')) != '')
  65. $style = 'background-color: '.($img).';';
  66. else {
  67. if (($img = themerex_get_custom_option('bg_custom_image')) != '')
  68. $style = 'background: url('.esc_url($img).') ' . str_replace('_', ' ', themerex_get_custom_option('bg_custom_image_position')) . ' no-repeat fixed;';
  69. else if (($img = themerex_get_custom_option('bg_custom_pattern')) != '')
  70. $style = 'background: url('.esc_url($img).') 0 0 repeat fixed;';
  71. else if (($img = themerex_get_custom_option('bg_image')) > 0)
  72. $class = 'bg_image_'.($img);
  73. else if (($img = themerex_get_custom_option('bg_pattern')) > 0)
  74. $class = 'bg_pattern_'.($img);
  75. if (($img = themerex_get_custom_option('bg_color')) != '')
  76. $style .= 'background-color: '.($img).';';
  77. }
  78. }
  79. ?>
  80.  
  81. <body <?php
  82. body_class('themerex_body body_style_' . esc_attr($body_style)
  83. . ' body_' . (themerex_get_custom_option('body_filled')=='yes' ? 'filled' : 'transparent')
  84. . ' theme_skin_' . esc_attr($theme_skin)
  85. . ' article_style_' . esc_attr($article_style)
  86. . ' layout_' . esc_attr($blog_style)
  87. . ' template_' . esc_attr(themerex_get_template_name($blog_style))
  88. . ' top_panel_style_' . esc_attr($top_panel_style)
  89. . ' top_panel_opacity_' . esc_attr($top_panel_opacity)
  90. . ($top_panel_position != 'hide' ? ' top_panel_show top_panel_' . esc_attr($top_panel_position) : '')
  91. . ' menu_' . esc_attr(themerex_get_custom_option('menu_align'))
  92. . ' user_menu_' . (themerex_get_custom_option('show_menu_user')=='yes' ? 'show' : 'hide')
  93. . ' ' . esc_attr(themerex_get_sidebar_class(themerex_get_custom_option('show_sidebar_main'), themerex_get_custom_option('sidebar_main_position')))
  94. . ($video_bg_show ? ' video_bg_show' : '')
  95. . ($class!='' ? ' ' . esc_attr($class) : '')
  96. );
  97. if ($style!='') echo ' style="'.esc_attr($style).'"';
  98. ?>
  99. >
  100. <?php echo force_balance_tags(themerex_get_custom_option('gtm_code')); ?>
  101.  
  102. <?php do_action( 'before' ); ?>
  103.  
  104. <?php
  105. if (themerex_get_custom_option('menu_toc_home')=='yes') echo do_shortcode( '[trx_anchor id="toc_home" title="'.__('Home', 'themerex').'" description="'.__('{Return to Home} - |navigate to home page of the site', 'themerex').'" icon="icon-home-1" separator="yes" url="'.home_url().'"]' );
  106. if (themerex_get_custom_option('menu_toc_top')=='yes') echo do_shortcode( '[trx_anchor id="toc_top" title="'.__('To Top', 'themerex').'" description="'.__('{Back to top} - |scroll to top of the page', 'themerex').'" icon="icon-angle-double-up" separator="yes"]' );
  107. ?>
  108. <div class="border top horizontal"></div>
  109. <div class="border right vertical"></div>
  110. <div class="border bottom horizontal"></div>
  111. <div class="border left vertical"></div>
  112.  
  113. <div class="body_wrap">
  114.  
  115. <?php
  116. if ($video_bg_show) {
  117. $youtube = themerex_get_custom_option('video_bg_youtube_code');
  118. $video = themerex_get_custom_option('video_bg_url');
  119. $overlay = themerex_get_custom_option('video_bg_overlay')=='yes';
  120. if (!empty($youtube)) {
  121. ?>
  122. <div class="video_bg<?php echo ($overlay ? ' video_bg_overlay' : ''); ?>" data-youtube-code="<?php echo esc_attr($youtube); ?>"></div>
  123. <?php
  124. } else if (!empty($video)) {
  125. $info = pathinfo($video);
  126. $ext = !empty($info['extension']) ? $info['extension'] : 'src';
  127. ?>
  128. <div class="video_bg<?php echo esc_attr($overlay) ? ' video_bg_overlay' : ''; ?>"><video class="video_bg_tag" width="1280" height="720" data-width="1280" data-height="720" data-ratio="16:9" preload="metadata" autoplay loop src="<?php echo esc_url($video); ?>"><source src="<?php echo esc_url($video); ?>" type="video/<?php echo esc_attr($ext); ?>"></source></video></div>
  129. <?php
  130. }
  131. }
  132. ?>
  133.  
  134. <div class="page_wrap">
  135.  
  136. <?php
  137. // Top panel and Slider
  138. if (in_array($top_panel_position, array('above', 'over'))) { require_once( themerex_get_file_dir('templates/parts/top-panel.php') ); }
  139. require_once( themerex_get_file_dir('templates/parts/slider.php') );
  140. if ($top_panel_position == 'below') { require_once( themerex_get_file_dir('templates/parts/top-panel.php') ); }
  141.  
  142. // User custom header
  143. if (themerex_get_custom_option('show_user_header') == 'yes') {
  144. $user_header = themerex_strclear(themerex_get_custom_option('user_header_content'), 'p');
  145. if (!empty($user_header)) {
  146. $user_header = themerex_substitute_all($user_header);
  147. ?>
  148. <div class="user_header_wrap"><?php echo ($user_header); ?></div>
  149. <?php
  150. }
  151. }
  152.  
  153. // Top of page section: page title and breadcrumbs
  154. $header_style = '';
  155. if ($top_panel_style=='light') {
  156. $header_image2 = get_header_image();
  157. $header_color = themerex_get_custom_option('show_page_top') == 'yes' ? apply_filters('themerex_filter_get_link_color', themerex_get_custom_option('top_panel_bg_color')) : '';
  158. if (empty($header_image2) && file_exists(themerex_get_file_dir('skins/'.($theme_skin).'/images/bg_over.png'))) {
  159. $header_image2 = themerex_get_file_url('skins/'.($theme_skin).'/images/bg_over.png');
  160. }
  161. if ($header_image2!='' || $header_color != '') {
  162. $header_style = ' style="' . ($header_image2!='' ? 'background-image: url('.esc_url($header_image2).'); background-repeat: repeat-x; background-position: center top;' : '') . ($header_color ? ' background-color:'.esc_attr($header_color).';' : '') . '"';
  163. }
  164. }
  165. if (themerex_get_custom_option('show_page_top') == 'yes') {
  166. $show_title = themerex_get_custom_option('show_page_title')=='yes';
  167. $show_breadcrumbs = themerex_get_custom_option('show_breadcrumbs')=='yes';
  168. ?>
  169. <div class="page_top_wrap<?php echo ($show_title ? ' page_top_title' : '') . ($show_breadcrumbs ? ' page_top_breadcrumbs' : ''); ?>"<?php echo ($header_style); ?>>
  170. <div class="content_wrap">
  171. <?php if ($show_breadcrumbs) { ?>
  172. <div class="breadcrumbs">
  173. <?php if (!is_404()) themerex_show_breadcrumbs(); ?>
  174. </div>
  175. <?php } ?>
  176. <?php if ($show_title) { ?>
  177. <h1 class="page_title"><?php echo strip_tags(themerex_get_blog_title()); ?></h1>
  178. <?php } ?>
  179. </div>
  180. </div>
  181. <?php
  182. }
  183. ?>
  184.  
  185. <div class="page_content_wrap"<?php echo (themerex_get_custom_option('show_page_top') == 'no' ? ' ' . trim($header_style) : ''); ?>>
  186.  
  187. <?php
  188. // Content and sidebar wrapper
  189. if ($body_style!='fullscreen') themerex_open_wrapper('<div class="content_wrap">');
  190.  
  191. // Main content wrapper
  192. themerex_open_wrapper('<div class="content">');
  193. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement