Brak opisu

functions.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. /*This file is part of BeShop child theme.
  3. All functions of this file will be loaded before of parent theme functions.
  4. Learn more at https://codex.wordpress.org/Child_Themes.
  5. Note: this function loads the parent stylesheet before, then child theme stylesheet
  6. (leave it in place unless you know what you are doing.)
  7. */
  8. if ( ! defined( 'XSHOP_LITE_VERSION' ) ) {
  9. // Replace the version number of the theme on each release.
  10. define( 'XSHOP_LITE_VERSION', '1.0.2' );
  11. }
  12. function xshop_lite_fonts_url() {
  13. $fonts_url = '';
  14. $font_families = array();
  15. $font_families[] = 'Gemunu Libre:400,500,700';
  16. $font_families[] = 'Roboto Condensed:400,500,500i,700,700i';
  17. $query_args = array(
  18. 'family' => urlencode( implode( '|', $font_families ) ),
  19. 'subset' => urlencode( 'latin,latin-ext' ),
  20. );
  21. $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
  22. return esc_url_raw( $fonts_url );
  23. }
  24. function xshop_lite_enqueue_child_styles() {
  25. wp_enqueue_style( 'xshop-lite-google-font',xshop_lite_fonts_url(), array(), null );
  26. wp_enqueue_style( 'xshop-lite-parent-style', get_template_directory_uri() . '/style.css',array('xshop-main-style','xshop-main-style','xshop-google-font', 'xshop-default-style', 'xshop-responsive-style','xshop-woocommerce-style'), '', 'all');
  27. wp_enqueue_style( 'xshop-lite-main',get_stylesheet_directory_uri() . '/assets/css/main.css',array(), XSHOP_LITE_VERSION, 'all');
  28. }
  29. add_action( 'wp_enqueue_scripts', 'xshop_lite_enqueue_child_styles');
  30. /**
  31. * Customizer additions.
  32. */
  33. require get_stylesheet_directory() . '/inc/customizer.php';
  34. // // Nav walker for menu
  35. function xshop_lite_header_top_output(){
  36. ?>
  37. <header id="masthead" class="site-header <?php if( has_header_image() ): ?>has-head-img<?php endif; ?>">
  38. <?php if( has_header_image() ): ?>
  39. <?php if( has_header_image() ): ?>
  40. <div class="header-img">
  41. <?php the_header_image_tag(); ?>
  42. </div>
  43. <?php endif; ?>
  44. <?php endif; ?>
  45. <div class="menu-bar text-center">
  46. <div class="container">
  47. <div class="col-auto">
  48. <?php
  49. if(has_custom_logo() || display_header_text() == true || (display_header_text() == true && is_customize_preview()) ): ?>
  50. <div class="site-branding brand-logo">
  51. <?php
  52. if(has_custom_logo()):
  53. the_custom_logo();
  54. endif;
  55. ?>
  56. </div>
  57. <div class="site-branding brand-text">
  58. <?php if (display_header_text() == true || (display_header_text() == true && is_customize_preview()) ): ?>
  59. <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
  60. <?php
  61. $xshop_description = get_bloginfo( 'description', 'display' );
  62. if ( $xshop_description || is_customize_preview() ) :
  63. ?>
  64. <p class="site-description"><?php echo $xshop_description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
  65. <?php endif; ?>
  66. <?php endif; ?>
  67. </div><!-- .site-branding -->
  68. <?php endif; ?>
  69. </div>
  70. <div class="col-auto">
  71. <div class="xshop-container menu-inner">
  72. <nav id="site-navigation" class="main-navigation">
  73. <?php
  74. wp_nav_menu( array(
  75. 'theme_location' => 'main-menu',
  76. 'menu_id' => 'xshop-menu',
  77. 'menu_class' => 'xshop-menu',
  78. ) );
  79. ?>
  80. </nav><!-- #site-navigation -->
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </header><!-- #masthead -->
  86. <?php
  87. }
  88. add_action('xshop_lite_header','xshop_lite_header_top_output');