Advertisement
Guest User

Untitled

a guest
Sep 12th, 2017
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 109.58 KB | None | 0 0
  1. <?php
  2. /*------------- THEME SETUP START -------------*/
  3. add_action( 'after_setup_theme', 'esport_setup' );
  4. function esport_setup(){
  5.     load_theme_textdomain( 'esport', get_template_directory() . '/languages' );
  6.     add_theme_support( 'automatic-feed-links' );
  7.     add_theme_support( 'title-tag' );
  8.     add_theme_support( 'custom-background' );
  9.     add_theme_support( 'post-thumbnails' );
  10.     add_theme_support( 'post-formats', array( 'quote', 'gallery', 'image', 'video', 'audio', 'chat', 'link' ) );
  11.    
  12.     if( function_exists( 'add_image_size' ) ) {
  13.         add_image_size( 'esport-big-post', 870, 450, true );
  14.         add_image_size( 'esport-small-post', 420, 290, true );
  15.         add_image_size( 'esport-slider', 1920, 850, true );
  16.         add_image_size( 'esport-player-avatar', 505, 655, true );
  17.         add_image_size( 'esport-team-logo', 200, 200, true );
  18.         add_theme_support( 'wc-product-gallery-zoom' );
  19.         add_theme_support( 'wc-product-gallery-lightbox' );
  20.         add_theme_support( 'wc-product-gallery-slider' );
  21.     }
  22.    
  23.     if( ! isset( $content_width ) ) {
  24.         $content_width = 600;
  25.     }
  26.    
  27.     if( is_singular() ) wp_enqueue_script( 'comment-reply' );
  28. }
  29. /*------------- THEME SETUP END -------------*/
  30.  
  31. /*------------- SCRIPTS AND STYLES FILE START -------------*/
  32. function esport_scripts()
  33. {
  34.     wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array(), false, true );
  35.     wp_enqueue_script( 'esport-animate', get_template_directory_uri() . '/assets/js/animate.js', array(), false, true  );
  36.     wp_enqueue_script( 'esport-scrollbar', get_template_directory_uri() . '/assets/js/scrollbar.min.js', array(), false, true  );
  37.     wp_enqueue_script( 'esport-admin-bar', get_template_directory_uri() . '/assets/js/admin-bar.js', array(), false, true  );
  38.     $esport_fixed_sidebar = ot_get_option( 'esport_fixed_sidebar' );
  39.     if( $esport_fixed_sidebar == 'on' or !$esport_fixed_sidebar == 'off' ) {
  40.         wp_enqueue_script( 'esport-fixed-sidebar', get_template_directory_uri() . '/assets/js/fixed-sidebar.js', array(), false, true  );
  41.     }
  42.     $header_fixed = ot_get_option( 'header_fixed' );
  43.     if( $header_fixed == 'on' ) {
  44.         wp_enqueue_script( 'esport-fixed-header', get_template_directory_uri() . '/assets/js/fixed-header.js', array(), false, true  );
  45.     }
  46.     wp_enqueue_script( 'waypoints', get_template_directory_uri() . '/assets/js/waypoints.min.js', array(), false, true  );
  47.     wp_enqueue_script( 'swiper', get_template_directory_uri() . '/assets/js/swiper.min.js', array(), false, true  );
  48.     wp_enqueue_script( 'counter', get_template_directory_uri() . '/assets/js/counter.js', array(), false, true  );
  49.     wp_enqueue_script( 'esport', get_template_directory_uri() . '/assets/js/esport.js', array(), false, true  );
  50.     if( ot_get_option('custom_js') !== "" ) {
  51.         wp_add_inline_script( "esport", "jQuery(document).ready(function($){" . ot_get_option('custom_js') . "});" );
  52.     }
  53.     wp_enqueue_script( 'countdown', get_template_directory_uri() . '/assets/js/countdown.min.js', array(), false, true  );
  54.     wp_enqueue_script( 'plyr-io', get_template_directory_uri() . '/assets/js/plyr.js', array(), false, true  );
  55.     wp_enqueue_script( 'select-classie', get_template_directory_uri() . '/assets/js/select-classie.js', array(), false, true  );
  56.     wp_enqueue_script( 'select-fx', get_template_directory_uri() . '/assets/js/select-fx.js', array(), false, true  );
  57.     wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css'  );
  58.     wp_enqueue_style( 'font-awesome-css', get_template_directory_uri() . '/assets/css/font-awesome.min.css'  );
  59.     wp_enqueue_style( 'animate', get_template_directory_uri() . '/assets/css/animate.css'  );
  60.     wp_enqueue_style( 'scrollbar', get_template_directory_uri() . '/assets/css/scrollbar.css'  );
  61.     wp_enqueue_style( 'select', get_template_directory_uri() . '/assets/css/select.css'  );
  62.     wp_enqueue_style( 'swiper', get_template_directory_uri() . '/assets/css/swiper.min.css'  );
  63.     wp_enqueue_style( 'plyr-io', get_template_directory_uri() . '/assets/css/plyr.css'  );
  64.     wp_enqueue_style( 'esport', get_stylesheet_uri() );
  65.     if( ot_get_option('custom_css') !== "" ) {
  66.         wp_add_inline_style( 'esport', ot_get_option('custom_css') );      
  67.     }
  68. }
  69. add_action( 'wp_enqueue_scripts', 'esport_scripts' );
  70.  
  71. function esport_load_custom_wp_admin() {
  72.     wp_enqueue_style( 'esport-admin', get_template_directory_uri() . '/assets/css/admin.css'  );
  73.     wp_enqueue_style( 'esport-ot-admin', get_template_directory_uri() . '/assets/css/admin-ot.css'  );
  74.     wp_enqueue_script( 'esport-admin-script', get_template_directory_uri() . '/assets/js/admin.js' );
  75. }
  76. add_action( 'admin_enqueue_scripts', 'esport_load_custom_wp_admin' );
  77. /*------------- SCRIPTS AND STYLES FILE END -------------*/
  78.  
  79. /*------------- BODY CLASS START -------------*/
  80. function esport_class_names( $classes ) {
  81.     $classes[] = 'esport-class';
  82.    
  83.     $woocommerce_shop_product_column = esc_attr( ot_get_option( 'woocommerce_shop_product_column' ) );
  84.     if( !empty( $woocommerce_shop_product_column ) ) {
  85.         $classes[] = ' esport-shop-column-' . $woocommerce_shop_product_column;
  86.     }
  87.    
  88.     return $classes;
  89. }
  90. add_filter( 'body_class', 'esport_class_names' );
  91. /*------------- BODY CLASS END -------------*/
  92.  
  93. /*------------- EXCERPT START -------------*/
  94. function esport_new_excerpt_more( $more ) {
  95.     return '...';
  96. }
  97. add_filter( 'excerpt_more', 'esport_new_excerpt_more' );
  98.  
  99. function esport_my_add_excerpts_to_pages() {
  100.     add_post_type_support( 'page', 'excerpt' );
  101. }
  102. add_action( 'init', 'esport_my_add_excerpts_to_pages' );
  103.  
  104. function esport_text_limit_words( $string, $word_limit ) {
  105.     $words = explode( ' ', $string, ( $word_limit + 1 ) );
  106.     if( count( $words ) > $word_limit ) {
  107.         array_pop( $words );
  108.     }
  109.     return implode( ' ', $words );
  110. }
  111. /*------------- EXCERPT END -------------*/
  112.  
  113. /*------------- AUTHOR BOX START -------------*/
  114. function esport_post_author() {
  115.     $author = get_the_author();
  116.     $author_description = get_the_author_meta( 'description' );
  117.     $author_url = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
  118.     $author_avatar = get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'wpex_author_bio_avatar_size', 120 ) );
  119.     if ( $author_description ) { ?>
  120.         <div class="post-author">
  121.             <?php esport_content_title_start( $text = esc_html__ ( "About The Author", "esport" ) ); ?>
  122.             <aside class="about-author">
  123.                 <?php if ( $author_avatar ) : ?>
  124.                     <div class="about-image">
  125.                         <a href="<?php echo esc_url( $author_url ); ?>" rel="author">
  126.                             <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'wpex_author_bio_avatar_size', 170 ) ); ?>
  127.                         </a>
  128.                     </div>
  129.                 <?php endif; ?>
  130.                 <div class="about-content">
  131.                     <div class="author-name">
  132.                         <a href="<?php echo esc_url( $author_url ); ?>" rel="author">
  133.                             <?php printf( esc_html__( '%s', 'esport' ), $author ); ?>
  134.                         </a>
  135.                     </div>
  136.                     <?php esport_user_profile_social_media_links(); ?>
  137.                     <p><?php echo esc_attr( $author_description ); ?></p>
  138.                 </div>
  139.             </aside>
  140.         </div>
  141.     <?php }
  142. }
  143. /*------------- AUTHOR BOX END -------------*/
  144.  
  145. /*------------- PAGE LOADING START -------------*/
  146. function esport_page_loading() {
  147.     $esport_loader = ot_get_option( 'esport_loader' );
  148.     if( $esport_loader == 'on' ) :
  149.         echo '<div class="loader-wrapper"><div class="spinner">
  150.                   <div class="double-bounce1"></div>
  151.                   <div class="double-bounce2"></div>
  152.                 </div>
  153.             </div>';
  154.     endif;
  155. }
  156. /*------------- PAGE LOADING END -------------*/
  157.  
  158. /*------------- FOOTER CONTENT START -------------*/
  159. function esport_footer() {
  160.     $hide_footer = ot_get_option( 'hide_footer' );
  161.     $default_footer_style = ot_get_option( 'default_footer_style' );
  162.     $page_footer_style_1 = ot_get_option( 'page_footer_style_1' );
  163.     $page_footer_style_2 = ot_get_option( 'page_footer_style_2' );
  164.    
  165.     if( !$hide_footer == 'off' or $hide_footer == 'on' ) {
  166.         if ( is_page() or is_single() ) {
  167.             global $post;
  168.             $footer_gap = get_post_meta( $post->ID, 'footer_gap', true);
  169.             $footer_style = get_post_meta( $post->ID, 'footer_layout_select', true);
  170.             $footer_status = get_post_meta( $post->ID, 'footer_status', true);
  171.         }
  172.         else {
  173.             $post = "";
  174.             $footer_gap = "";
  175.             $footer_style = "";
  176.             $footer_status = "";
  177.         }
  178.  
  179.         if( !$footer_gap == 'off' or $footer_gap == "on" ) {
  180.             $footer_gap_status = "remove-gap";
  181.         } else {
  182.             $footer_gap_status = "remove-gap-removed";         
  183.         }
  184.  
  185.         function esport_copyright( $extra_class = "" ) {
  186.             $hide_footer_copyright_menu = ot_get_option( 'hide_footer_copyright_menu' );
  187.             $footer_copyright_text = ot_get_option( 'footer_copyright_text' );
  188.             if( !empty( $footer_copyright_text ) or !$hide_footer_copyright_menu == 'off' or $hide_footer_copyright_menu == "on" ) {
  189.                 echo '<div class="footer-copyright ' . esc_attr( $extra_class ) . '">';
  190.                     echo '<div class="container">';
  191.                         if( !empty( $footer_copyright_text ) ) {
  192.                             echo '<p>' . esc_attr( $footer_copyright_text ) . '</p>';
  193.                         }
  194.  
  195.                         if( !$hide_footer_copyright_menu == 'off' or $hide_footer_copyright_menu == "on" ) {
  196.                             wp_nav_menu(
  197.                                 array(
  198.                                     'menu' => 'footermenu',
  199.                                     'theme_location' => 'footermenu',
  200.                                     'depth' => 1,
  201.                                     'container' => 'div',
  202.                                     'fallback_cb' => 'esport_walker::fallback',
  203.                                     'walker' => new esport_walker()
  204.                                 )
  205.                             );
  206.                         }
  207.                     echo '</div>';
  208.                 echo '</div>';
  209.             }
  210.         }
  211.        
  212.         function esport_footerstyle1() {
  213.             $page_footer_style_1 = ot_get_option( 'page_footer_style_1' );
  214.             if ( is_page() or is_single() ) {
  215.                 global $post;
  216.                 $footer_gap = get_post_meta( $post->ID, 'footer_gap', true);
  217.             }
  218.             else {
  219.                 $post = "";
  220.                 $footer_gap = "";
  221.             }
  222.  
  223.             if( !$footer_gap == 'off' or $footer_gap == "on" ) {
  224.                 $footer_gap_status = "remove-gap";
  225.             } else {
  226.                 $footer_gap_status = "remove-gap-removed";         
  227.             }
  228.             ?>
  229.                 <footer class="footer footer-style1 <?php echo esc_attr( $footer_gap_status ); ?>" id="Footer">
  230.                     <?php esport_container_before(); ?>
  231.                         <div class="footer-content">
  232.                             <?php
  233.                                 $args_footer_page_content = array(
  234.                                     'p' => $page_footer_style_1,
  235.                                     'ignore_sticky_posts' => true,
  236.                                     'post_type' => 'page',
  237.                                     'post_status' => 'publish'
  238.                                 );
  239.                                 $wp_query = new WP_Query( $args_footer_page_content );
  240.                                 while ( $wp_query->have_posts() ) :
  241.                                 $wp_query->the_post();
  242.                                 $postid = get_the_ID();
  243.                             ?>
  244.                                 <?php echo do_shortcode( get_the_content() ); ?>
  245.                             <?php endwhile; ?>
  246.                             <?php wp_reset_postdata(); ?>
  247.                         </div>
  248.                     <?php esport_container_after(); ?>
  249.                 </footer>
  250.                 <?php esport_copyright(); ?>
  251.             <?php
  252.         }
  253.        
  254.         function esport_footerstyle2() {
  255.             $page_footer_style_2 = ot_get_option( 'page_footer_style_2' );
  256.             if ( is_page() or is_single() ) {
  257.                 global $post;
  258.                 $footer_gap = get_post_meta( $post->ID, 'footer_gap', true);
  259.             }
  260.             else {
  261.                 $post = "";
  262.                 $footer_gap = "";
  263.             }
  264.  
  265.             if( !$footer_gap == 'off' or $footer_gap == "on" ) {
  266.                 $footer_gap_status = "remove-gap";
  267.             } else {
  268.                 $footer_gap_status = "remove-gap-removed";         
  269.             }
  270.             ?>
  271.                 <footer class="footer footer-style2 <?php echo esc_attr( $footer_gap_status ); ?>" id="Footer">
  272.                     <?php esport_container_before(); ?>
  273.                         <div class="footer-content">
  274.                             <?php
  275.                                 $args_footer_page_content = array(
  276.                                     'p' => $page_footer_style_2,
  277.                                     'ignore_sticky_posts' => true,
  278.                                     'post_type' => 'page',
  279.                                     'post_status' => 'publish'
  280.                                 );
  281.                                 $wp_query = new WP_Query( $args_footer_page_content );
  282.                                 while ( $wp_query->have_posts() ) :
  283.                                 $wp_query->the_post();
  284.                                 $postid = get_the_ID();
  285.                             ?>
  286.                                 <?php echo do_shortcode( get_the_content() ); ?>
  287.                             <?php endwhile; ?>
  288.                             <?php wp_reset_postdata(); ?>
  289.                         </div>
  290.                     <?php esport_container_after(); ?>
  291.                 </footer>
  292.                 <?php esport_copyright( $extra_class = "style2" ); ?>
  293.             <?php
  294.         }
  295.        
  296.         if( !$footer_status == 'off' or $footer_status == "on" ) {
  297.        
  298.             if( !$page_footer_style_1 == '0' and !empty( $page_footer_style_1  ) or !$page_footer_style_2 == '0' and !empty( $page_footer_style_2  ) ) {
  299.                
  300.                 if ( is_page() or is_single() ) {
  301.                    
  302.                     if( $footer_style == "footer-style-2" ) {
  303.                         esport_footerstyle2();
  304.                     } elseif( $footer_style == "footer-style-1" ) {
  305.                         esport_footerstyle1();
  306.                     } else {
  307.                        
  308.                         if( $default_footer_style == "footer-style-2" ) {
  309.                             esport_footerstyle2();
  310.                         } else {
  311.                             esport_footerstyle1();
  312.                         }
  313.                        
  314.                     }
  315.                    
  316.                 } elseif( is_category() ) {
  317.                
  318.                     $cat = get_queried_object();
  319.                     $cat_id = $cat->term_id;
  320.                     $esport_category_footer_style = get_term_meta( $cat_id, 'esport_category_footer_style', true );
  321.                    
  322.                     if( $esport_category_footer_style == "footer-style-2" ) {
  323.                         esport_footerstyle2();
  324.                     } elseif( $esport_category_footer_style == "footer-style-1" ) {
  325.                         esport_footerstyle1();
  326.                     } else {
  327.                        
  328.                         if( $default_footer_style == "footer-style-2" ) {
  329.                             esport_footerstyle2();
  330.                         } else {
  331.                             esport_footerstyle1();
  332.                         }
  333.                        
  334.                     }
  335.                    
  336.                 } else {
  337.                    
  338.                     if( $default_footer_style == "footer-style-2" ) {
  339.                         esport_footerstyle2();
  340.                     } else {
  341.                         esport_footerstyle1();
  342.                     }
  343.                    
  344.                 }
  345.            
  346.             } else {
  347.                 echo '<div class="no-footer-blank"></div>';
  348.             }
  349.         } else {
  350.             echo '<div class="no-footer-blank"></div>';
  351.         }
  352.        
  353.     } else {
  354.         echo '<div class="no-footer-blank"></div>';
  355.     }
  356. }
  357. /*------------- FOOTER CONTENT END -------------*/
  358.  
  359. /*------------- DATE FORMAT START -------------*/
  360. function esport_global_date_format( $date = "" ) {
  361.     $date = date_i18n( get_option( 'date_format' ), strtotime( $date ) );
  362.     return $date;
  363. }
  364.  
  365. function esport_global_date_format_no_year( $date = "" ) {
  366.     $date = date_i18n( 'M d, Y', strtotime( $date ) );
  367.     return $date;
  368. }
  369. /*------------- DATE FORMAT END -------------*/
  370.  
  371. /*------------- POST FEATURED HEADER START -------------*/
  372. function esport_post_featured_header( $post_id = "" ) {
  373.     $featured_header_status = get_post_meta( $post_id, 'featured_header_status', true );
  374.     $post_gallery_images_control =  get_post_meta( $post_id, 'post_images', true );
  375.  
  376.     if( $featured_header_status == "on" or !$featured_header_status == "off" ) {
  377.         if ( has_post_format( 'video' ) ) {
  378.             $post_video_embed = get_post_meta( $post_id, 'post_video_embed', true );
  379.             if( !empty( $post_video_embed ) ) {
  380.                 $post_video_embed_new = stripcslashes( $post_video_embed );
  381.                 echo '<div class="post-featured-header">';
  382.                     echo stripslashes( addslashes( $post_video_embed_new ) );
  383.  
  384.                     $post_post_category_name = ot_get_option( 'post_post_category_name' );
  385.                     if ( !$post_post_category_name == 'off' or $post_post_category_name == 'on' ) {
  386.                         echo '<div class="category">';
  387.                             the_category( '', '' );
  388.                         echo '</div>';
  389.                     }
  390.                 echo '</div>';
  391.             }
  392.         } elseif( has_post_format( 'audio' ) ) {
  393.             $post_audio_embed = get_post_meta( $post_id, 'post_audio_embed', true );
  394.             if( !empty( $post_audio_embed ) ) {
  395.                 $post_audio_embed_new = stripcslashes( $post_audio_embed );
  396.                 echo '<div class="post-featured-header">';
  397.                     echo stripslashes( addslashes( $post_audio_embed_new ) );
  398.  
  399.                     $post_post_category_name = ot_get_option( 'post_post_category_name' );
  400.                     if ( !$post_post_category_name == 'off' or $post_post_category_name == 'on' ) {
  401.                         echo '<div class="category">';
  402.                             the_category( '', '' );
  403.                         echo '</div>';
  404.                     }
  405.                 echo '</div>';
  406.             }
  407.         } elseif( has_post_format( 'gallery' ) and !empty( $post_gallery_images_control ) ) {
  408.             $post_gallery_images =  explode( ',', get_post_meta( $post_id, 'post_images', true ) );
  409.             if( !empty( $post_gallery_images ) ) {
  410.                 echo '<div class="post-featured-header">';
  411.                     echo '<div class="swiper-container post-featured-header-image-gallery">';
  412.                         echo '<div class="swiper-wrapper">';
  413.                             foreach ($post_gallery_images as $image) {
  414.                                 echo '<div class="swiper-slide">' . wp_get_attachment_image( $image, 'esport-big-post', true, true ) . '</div>';
  415.                             }
  416.                         echo '</div>';
  417.                     echo '</div>';
  418.  
  419.                     $post_post_category_name = ot_get_option( 'post_post_category_name' );
  420.                     if ( !$post_post_category_name == 'off' or $post_post_category_name == 'on' ) {
  421.                         echo '<div class="category">';
  422.                             the_category( '', '' );
  423.                         echo '</div>';
  424.                     }
  425.                     echo '<div class="swiper-button-next"></div>';
  426.                     echo '<div class="swiper-button-prev"></div>';
  427.                 echo '</div>';
  428.             }
  429.         } else {
  430.             $post_post_image = ot_get_option( 'post_post_image' );
  431.             if ( !$post_post_image == 'off' or $post_post_image == 'on' ) {
  432.                 if ( has_post_thumbnail() ) {
  433.                     echo '<div class="post-featured-header">';
  434.                         echo get_the_post_thumbnail( $post_id, 'esport-big-post' );
  435.  
  436.                         $post_post_category_name = ot_get_option( 'post_post_category_name' );
  437.                         if ( !$post_post_category_name == 'off' or $post_post_category_name == 'on' ) {
  438.                             if( is_single() ) {
  439.                                 echo '<div class="category">';
  440.                                     the_category( '', '' );
  441.                                 echo '</div>';
  442.                             }
  443.                         }
  444.                     echo '</div>';
  445.                 }
  446.             }
  447.         }
  448.     }
  449. }
  450. /*------------- POST FEATURED HEADER END -------------*/
  451.  
  452. /*------------- ATTACHMENT ID START -------------*/
  453. if( ! function_exists( 'esport_get_attachment_id_from_guid' ) ) {
  454.     function esport_get_attachment_id_from_guid( $url ) {
  455.         $attachment_id = 0;
  456.         $dir = wp_upload_dir();
  457.         if ( false !== strpos( $url, $dir['baseurl'] . '/' ) ) { // Is URL in uploads directory?
  458.             $file = basename( $url );
  459.             $query_args = array(
  460.                 'post_type'   => 'attachment',
  461.                 'post_status' => 'inherit',
  462.                 'fields'      => 'ids',
  463.                 'meta_query'  => array(
  464.                     array(
  465.                         'value'   => $file,
  466.                         'compare' => 'LIKE',
  467.                         'key'     => '_wp_attachment_metadata',
  468.                     ),
  469.                 )
  470.             );
  471.             $query = new WP_Query( $query_args );
  472.             if ( $query->have_posts() ) {
  473.                 foreach ( $query->posts as $post_id ) {
  474.                     $meta = wp_get_attachment_metadata( $post_id );
  475.                     $original_file       = basename( $meta['file'] );
  476.                     $cropped_image_files = wp_list_pluck( $meta['sizes'], 'file' );
  477.                     if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
  478.                         $attachment_id = $post_id;
  479.                         break;
  480.                     }
  481.                 }
  482.             }
  483.         }
  484.         return $attachment_id;
  485.     }
  486. }
  487. /*------------- ATTACHMENT ID START -------------*/
  488.  
  489. /*------------- GENERAL TO SLUG START -------------*/
  490. function esport_to_slug( $string ){
  491.     return strtolower( trim( preg_replace('/[^A-Za-z0-9-]+/', '-', $string ) ) );
  492. }
  493. /*------------- GENERAL TO SLUG END -------------*/
  494.  
  495. /*------------- RELATED POSTS START -------------*/
  496. function esport_post_related_navigation() {
  497.     global $post;
  498.     $tags = wp_get_post_tags( $post->ID );
  499.     $post_related_posts = ot_get_option( 'post_related_posts' );
  500.     $post_post_navigation = ot_get_option( 'post_post_navigation' );
  501.  
  502.     $post_related_count = ot_get_option( 'post_related_posts_column' );
  503.     if( !empty( $post_related_count ) ) {
  504.         $post_related_count = $post_related_count;
  505.     } else {
  506.         $post_related_count = "3";
  507.     }
  508.    
  509.     if( !$post_related_posts == 'off' or $post_related_posts == 'on' or !$post_post_navigation == 'off' or $post_post_navigation == 'on' ) {
  510.         echo '<div class="post-related-navigation">';
  511.             if( !$post_related_posts == 'off' or $post_related_posts == 'on' ) {
  512.                 if ( $tags ) {
  513.                 ?>
  514.                     <?php esport_content_title_start( $text = esc_html__ ( "Related Posts", "esport" ) ); ?>
  515.                     <div class="related-posts-columns related-posts-column-<?php echo esc_attr( $post_related_count ); ?>">
  516.                         <?php
  517.                             $tag_ids = array();
  518.                             foreach( $tags as $individual_tag ) $tag_ids[] = $individual_tag->term_id;
  519.                             $args = array(
  520.                                 'tag__in' => $tag_ids,
  521.                                 'post__not_in' => array( $post->ID ),
  522.                                 'post_status' => 'publish',
  523.                                 'posts_type' => 'post',
  524.                                 'ignore_sticky_posts' => true,
  525.                                 'posts_per_page' => $post_related_count
  526.                             );
  527.                             $my_query = new wp_query( $args );
  528.                             while( $my_query->have_posts() ) {
  529.                                 $my_query->the_post();
  530.                                 echo esport_post_list_style_2( $post_id = get_the_ID(), $image = "true", $category = "false", $excerpt = "false", $read_more = "false", $post_info = "true" );
  531.                             }
  532.                             wp_reset_postdata();
  533.                         ?>
  534.                     </div>
  535.                 <?php }
  536.             }
  537.  
  538.             if ( !$post_post_navigation == 'off' or $post_post_navigation == 'on' ) {
  539.                 esport_post_navigation();
  540.             }
  541.         echo '</div>';
  542.     }
  543. }
  544. /*------------- RELATED POSTS END -------------*/
  545.  
  546. /*------------- PAGINATION START -------------*/
  547. function esport_pagination() {
  548.     if( is_singular() )
  549.         return;
  550.  
  551.     global $wp_query;
  552.  
  553.     if( $wp_query->max_num_pages <= 1 )
  554.         return;
  555.  
  556.     $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
  557.     $max   = intval( $wp_query->max_num_pages );
  558.  
  559.     if( $paged >= 1 )
  560.         $links[] = $paged;
  561.  
  562.     if( $paged >= 3 ) {
  563.         $links[] = $paged - 1;
  564.         $links[] = $paged - 2;
  565.     }
  566.  
  567.     if( ( $paged + 2 ) <= $max ) {
  568.         $links[] = $paged + 2;
  569.         $links[] = $paged + 1;
  570.     }
  571.  
  572.     $esport_post_navigation_prev = '<span>' . esc_html__( 'Previous', 'esport' ) . '</span>';
  573.     $esport_post_navigation_next = '<span>' . esc_html__( 'Next', 'esport' ) . '</span>';
  574.     $prev_text = '<i class="fa fa-angle-left" aria-hidden="true"></i>' . $esport_post_navigation_prev;
  575.     $next_text = $esport_post_navigation_next . '<i class="fa fa-angle-right" aria-hidden="true"></i>';
  576.  
  577.     echo '<nav class="post-pagination"><ul>' . "\n";
  578.  
  579.     if( get_previous_posts_link() )
  580.         printf( '<li>' . get_previous_posts_link( $prev_text ) . '</li>' );
  581.  
  582.     ?>
  583.         <li class="total-pages"><span><?php echo esc_html__( 'Page', 'esport' ) . ' ' . $paged . ' ' . esc_html__( 'of', 'esport' ) . ' ' . $max; ?></span></li>
  584.     <?php
  585.     if( get_next_posts_link() )
  586.         printf( '<li>' . get_next_posts_link( $next_text ) . '</li>' );
  587.  
  588.     echo '</ul></nav>' . "\n";
  589. }
  590. /*------------- PAGINATION END -------------*/
  591.  
  592. /*------------- PLAYER TEMPLATE START -------------*/
  593. if( !function_exists('esport_player_template') )
  594. {
  595.     function esport_player_template( $post_id = "" ) {
  596.         $output = '<div class="player-wrapper">';
  597.             if ( has_post_thumbnail() ) {
  598.                 $bg_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'esport-player-avatar' );
  599.             } else {
  600.                 $bg_url = "";
  601.             }
  602.            
  603.             $player_username = get_post_meta( $post_id, "player_username", true );
  604.             $team_profession = get_post_meta( $post_id, "team_profession", true );
  605.             $output .= '<div class="image" style="background-image:url(' . esc_url( $bg_url[0] ) . ');" >';
  606.                 $output .= '<div class="content">';
  607.                     if( !empty( $player_username ) ) {
  608.                         $output .= '<div class="username">' . esc_attr( $player_username ) . '</div>';
  609.                     }
  610.                     if( !empty( $team_profession ) ) {
  611.                         $output .= '<div class="username">' . esc_attr( $team_profession ) . '</div>';
  612.                     }
  613.                     if( !empty( get_the_title() ) ) {
  614.                         $output .= '<div class="name">' . get_the_title( $post_id ) . '</div>';
  615.                     }
  616.                 $output .= '</div>';
  617.                 $output .= '<div class="hover-content">';
  618.                     $output .= '<a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0) ) . '"><div class="view-profile"><span>' . esc_html__( 'View Profile', 'esport' ) . '</span></div></a>';
  619.                 $output .= '</div>';
  620.             $output .= '</div>';
  621.         $output .= '</div>';
  622.         return $output;
  623.     }
  624. }
  625. /*------------- PLAYER TEMPLATE END -------------*/
  626.  
  627. /*------------- POST NAVIGATION START -------------*/
  628. function esport_post_navigation() {
  629.     $esport_post_navigation_prev = '<span>' . esc_html__( 'Previous', 'esport' ) . '</span>';
  630.     $esport_post_navigation_next = '<span>' . esc_html__( 'Next', 'esport' ) . '</span>';
  631.     $prevPost = get_previous_post( false );
  632.     $nextPost = get_next_post( false );
  633. ?>
  634.     <div class="post-navigation">
  635.         <nav>
  636.             <ul>
  637.                 <?php if( !empty( $prevPost ) ) { ?>
  638.                     <li class="previous">
  639.                         <?php previous_post_link( '%link', '<i class="fa fa-angle-left" aria-hidden="true"></i>' . $esport_post_navigation_prev ); ?>
  640.                     </li>
  641.                 <?php } ?>
  642.                 <?php if( !empty( $nextPost ) ) { ?>
  643.                     <li class="next">
  644.                         <?php next_post_link( '%link', $esport_post_navigation_next . '<i class="fa fa-angle-right" aria-hidden="true"></i>' ); ?>
  645.                     </li>
  646.                 <?php } ?>
  647.             </ul>
  648.         </nav>
  649.     </div>
  650. <?php
  651. }
  652.  
  653. function esport_latest_posts_pagination( $paged = "", $query = "" ) {
  654.     if( !empty( $paged ) or !empty( $query ) ) {
  655.         $output = "";
  656.         $esport_post_navigation_prev = '<span>' . esc_html__( 'Previous Posts', 'esport' ) . '</span>';
  657.         $esport_post_navigation_next = '<span>' . esc_html__( 'Next Posts', 'esport' ) . '</span>';
  658.         $prev_text = '<i class="fa fa-angle-left" aria-hidden="true"></i>' . $esport_post_navigation_prev;
  659.         $next_text = $esport_post_navigation_next . '<i class="fa fa-angle-right" aria-hidden="true"></i>';
  660.         $output .= '<nav class="post-pagination">';
  661.             $output .= '<ul>';
  662.                 if( !empty( get_previous_posts_link( $prev_text ) ) ) {
  663.                     $output .= '<li class="previous">' . get_previous_posts_link( $prev_text ) . '</li>';                  
  664.                 }
  665.                 if( !empty( get_next_posts_link( $next_text, $query->max_num_pages ) ) ) {
  666.                     $output .= '<li class="next">' . get_next_posts_link( $next_text, $query->max_num_pages ) . '</li>';
  667.                 }
  668.             $output.= '</ul>';
  669.         $output .= '</nav>';
  670.         return $output;
  671.     }
  672. }
  673. /*------------- POST NAVIGATION END -------------*/
  674.  
  675. /*------------- CONTACT FORM 7 START -------------*/
  676. function esport_mycustom_wpcf7_form_elements( $form ) {
  677.     $form = do_shortcode( $form );
  678.     return $form;
  679. }
  680. add_filter( 'wpcf7_form_elements', 'esport_mycustom_wpcf7_form_elements' );
  681. /*------------- CONTACT FORM 7 END -------------*/
  682.  
  683. /*------------- HEADER START -------------*/
  684.     /*------------- HEADER STYLES START -------------*/
  685.     function esport_header() {
  686.         $hide_header = ot_get_option( 'hide_header' );
  687.         $default_header_style = ot_get_option( 'default_header_style' );
  688.        
  689.         if( !$hide_header == 'off' or $hide_header == 'on' ) {
  690.             if ( is_page() or is_single() ) {
  691.                 global $post;
  692.                 $header_style = get_post_meta( $post->ID, 'header_layout_select', true);
  693.                 $header_status = get_post_meta( $post->ID, 'header_status', true);
  694.                 $header_gap = get_post_meta( $post->ID, 'header_gap', true);
  695.             }
  696.             else {
  697.                 $header_style = "";
  698.                 $header_status = "";
  699.                 $header_gap = "";
  700.             }
  701.  
  702.             if( !$header_gap == 'off' or $header_gap == "on" ) {
  703.                 $header_gap_status = "remove-gap";
  704.             } else {
  705.                 $header_gap_status = "remove-gap-removed";         
  706.             }
  707.            
  708.             function esport_headerstyle1() {
  709.                 if ( is_page() or is_single() ) {
  710.                     global $post;
  711.                     $header_gap = get_post_meta( $post->ID, 'header_gap', true);
  712.                 }
  713.                 else {
  714.                     $header_gap = "";
  715.                 }
  716.  
  717.                 if( !$header_gap == 'off' or $header_gap == "on" ) {
  718.                     $header_gap_status = "remove-gap";
  719.                 } else {
  720.                     $header_gap_status = "remove-gap-removed";         
  721.                 }
  722.             ?>
  723.                 <div class="header header-style-1<?php echo ' ' . esc_attr( $header_gap_status ); ?>">
  724.                     <div class="container">
  725.                         <div class="header-main-area">
  726.                             <?php esport_site_logo(); ?>
  727.                             <div class="header-elements">
  728.                                 <?php esport_header_styles_main_elements(); ?>
  729.                             </div>
  730.                             <div class="header-menu">
  731.                                 <nav class="navbar">
  732.                                     <?php
  733.                                         wp_nav_menu(
  734.                                             array(
  735.                                                 'menu' => 'mainmenu',
  736.                                                 'theme_location' => 'mainmenu',
  737.                                                 'depth' => 5,
  738.                                                 'container' => 'div',
  739.                                                 'container_class' => 'collapse navbar-collapse',
  740.                                                 'menu_class' => 'nav navbar-nav',
  741.                                                 'fallback_cb' => 'esport_walker::fallback',
  742.                                                 'walker' => new esport_walker()
  743.                                             )
  744.                                         );
  745.                                     ?>
  746.                                 </nav>
  747.                             </div>
  748.                         </div>
  749.                     </div>
  750.                 </div>
  751.             <?php
  752.             }
  753.            
  754.             function esport_headerstyle2() {
  755.                 if ( is_page() or is_single() ) {
  756.                     global $post;
  757.                     $header_gap = get_post_meta( $post->ID, 'header_gap', true);
  758.                 }
  759.                 else {
  760.                     $header_gap = "";
  761.                 }
  762.  
  763.                 if( !$header_gap == 'off' or $header_gap == "on" ) {
  764.                     $header_gap_status = "remove-gap";
  765.                 } else {
  766.                     $header_gap_status = "remove-gap-removed";         
  767.                 }
  768.             ?>
  769.                 <div class="header header-style-1 header-style-2<?php echo ' ' . esc_attr( $header_gap_status ); ?>">
  770.                     <div class="container">
  771.                         <div class="header-main-area">
  772.                             <?php esport_site_logo(); ?>
  773.                             <?php esport_site_alternative_logo(); ?>
  774.                             <div class="header-elements">
  775.                                 <?php esport_header_styles_main_elements(); ?>
  776.                             </div>
  777.                             <div class="header-menu">
  778.                                 <nav class="navbar">
  779.                                     <?php
  780.                                         wp_nav_menu(
  781.                                             array(
  782.                                                 'menu' => 'mainmenu',
  783.                                                 'theme_location' => 'mainmenu',
  784.                                                 'depth' => 5,
  785.                                                 'container' => 'div',
  786.                                                 'container_class' => 'collapse navbar-collapse',
  787.                                                 'menu_class' => 'nav navbar-nav',
  788.                                                 'fallback_cb' => 'esport_walker::fallback',
  789.                                                 'walker' => new esport_walker()
  790.                                             )
  791.                                         );
  792.                                     ?>
  793.                                 </nav>
  794.                             </div>
  795.                         </div>
  796.                     </div>
  797.                 </div>
  798.             <?php
  799.             }
  800.            
  801.             function esport_headerstyle3() {
  802.                 if ( is_page() or is_single() ) {
  803.                     global $post;
  804.                     $header_gap = get_post_meta( $post->ID, 'header_gap', true);
  805.                 }
  806.                 else {
  807.                     $header_gap = "";
  808.                 }
  809.  
  810.                 if( !$header_gap == 'off' or $header_gap == "on" ) {
  811.                     $header_gap_status = "remove-gap";
  812.                 } else {
  813.                     $header_gap_status = "remove-gap-removed";         
  814.                 }
  815.             ?>
  816.                 <div class="header header-style-1 header-style-3<?php echo ' ' . esc_attr( $header_gap_status ); ?>">
  817.                     <div class="container">
  818.                         <div class="header-main-area">
  819.                             <?php esport_site_logo(); ?>
  820.                             <div class="header-elements">
  821.                                 <?php esport_header_styles_main_elements(); ?>
  822.                             </div>
  823.                             <div class="header-menu">
  824.                                 <nav class="navbar">
  825.                                     <?php
  826.                                         wp_nav_menu(
  827.                                             array(
  828.                                                 'menu' => 'mainmenu',
  829.                                                 'theme_location' => 'mainmenu',
  830.                                                 'depth' => 5,
  831.                                                 'container' => 'div',
  832.                                                 'container_class' => 'collapse navbar-collapse',
  833.                                                 'menu_class' => 'nav navbar-nav',
  834.                                                 'fallback_cb' => 'esport_walker::fallback',
  835.                                                 'walker' => new esport_walker()
  836.                                             )
  837.                                         );
  838.                                     ?>
  839.                                 </nav>
  840.                             </div>
  841.                         </div>
  842.                     </div>
  843.                 </div>
  844.             <?php
  845.             }
  846.            
  847.             function esport_headerstyle4() {
  848.                 if ( is_page() or is_single() ) {
  849.                     global $post;
  850.                     $header_gap = get_post_meta( $post->ID, 'header_gap', true);
  851.                 }
  852.                 else {
  853.                     $header_gap = "";
  854.                 }
  855.  
  856.                 if( !$header_gap == 'off' or $header_gap == "on" ) {
  857.                     $header_gap_status = "remove-gap";
  858.                 } else {
  859.                     $header_gap_status = "remove-gap-removed";         
  860.                 }
  861.             ?>
  862.                 <div class="header header-style-1 header-style-4<?php echo ' ' . esc_attr( $header_gap_status ); ?>">
  863.                     <div class="container">
  864.                         <div class="header-main-area">
  865.                             <?php esport_site_logo(); ?>
  866.                             <div class="header-elements">
  867.                                 <?php esport_header_styles_main_elements(); ?>
  868.                             </div>
  869.                             <div class="header-menu">
  870.                                 <nav class="navbar">
  871.                                     <?php
  872.                                         wp_nav_menu(
  873.                                             array(
  874.                                                 'menu' => 'mainmenu',
  875.                                                 'theme_location' => 'mainmenu',
  876.                                                 'depth' => 5,
  877.                                                 'container' => 'div',
  878.                                                 'container_class' => 'collapse navbar-collapse',
  879.                                                 'menu_class' => 'nav navbar-nav',
  880.                                                 'fallback_cb' => 'esport_walker::fallback',
  881.                                                 'walker' => new esport_walker()
  882.                                             )
  883.                                         );
  884.                                     ?>
  885.                                 </nav>
  886.                             </div>
  887.                         </div>
  888.                     </div>
  889.                 </div>
  890.             <?php
  891.             }
  892.            
  893.             if( !$header_status == 'off' or $header_status == "on" ) {
  894.                
  895.                 if ( is_page() or is_single() ) {
  896.                    
  897.                     if( $header_style == "header-style-2" ) {
  898.                         esport_headerstyle2();
  899.                     } elseif( $header_style == "header-style-1" ) {
  900.                         esport_headerstyle1();
  901.                     } else {
  902.                        
  903.                         if( $default_header_style == "header-style-2" ) {
  904.                             esport_headerstyle2();
  905.                         } else {
  906.                             esport_headerstyle1();
  907.                         }
  908.                        
  909.                     }
  910.                    
  911.                 } elseif( is_category() ) {
  912.                    
  913.                     $cat = get_queried_object();
  914.                     $cat_id = $cat->term_id;
  915.                     $esport_category_header_style = get_term_meta( $cat_id, 'esport_category_header_style', true );
  916.                    
  917.                     if( $esport_category_header_style == "header-style-2" ) {
  918.                         esport_headerstyle2();
  919.                     } elseif( $esport_category_header_style == "header-style-1" ) {
  920.                         esport_headerstyle1();
  921.                     } else {
  922.                        
  923.                         if( $default_header_style == "header-style-2" ) {
  924.                             esport_headerstyle2();
  925.                         } else {
  926.                             esport_headerstyle1();
  927.                         }
  928.                        
  929.                     }
  930.                    
  931.                 } else {
  932.                
  933.                     if( $default_header_style == "header-style-2" ) {
  934.                         esport_headerstyle2();
  935.                     } else {
  936.                         esport_headerstyle1();
  937.                     }
  938.  
  939.                 }
  940.                
  941.             }
  942.         }
  943.     }
  944.     /*------------- HEADER STYLES START END -------------*/
  945.  
  946.     /*------------- HEADER MOBILE START -------------*/
  947.     function esport_mobile_header() {
  948.         ?>
  949.             <header class="mobile-header">
  950.                 <div class="logo-area">
  951.                     <div class="container">
  952.                         <?php esport_site_logo(); ?>
  953.                         <div class="mobile-menu-icon">
  954.                             <i class="fa fa-bars" aria-hidden="true"></i>
  955.                         </div>
  956.                     </div>
  957.                 </div>
  958.             </header>
  959.             <div class="mobile-menu-wrapper"></div>
  960.             <div class="mobile-menu scrollbar-outer">
  961.                 <div class="mobile-menu-top">
  962.                     <div class="logo-area">
  963.                         <?php esport_site_logo(); ?>
  964.                         <div class="mobile-menu-icon">
  965.                             <i class="fa fa-times-thin" aria-hidden="true"></i>
  966.                         </div>
  967.                     </div>
  968.                     <nav class="mobile-navbar">
  969.                         <?php
  970.                             wp_nav_menu(
  971.                                 array(
  972.                                     'menu' => 'mainmenu',
  973.                                     'theme_location' => 'mainmenu',
  974.                                     'depth' => 5,
  975.                                     'container' => 'div',
  976.                                     'container_class' => 'collapse navbar-collapse',
  977.                                     'menu_class' => 'nav navbar-nav',
  978.                                     'fallback_cb' => 'esport_walker::fallback',
  979.                                     'walker' => new esport_walker()
  980.                                 )
  981.                             );
  982.                         ?>
  983.                     </nav>
  984.                 </div>
  985.                 <div class="mobile-menu-bottom">
  986.                     <?php esport_header_styles_main_elements(); ?>
  987.                 </div>
  988.             </div>
  989.         <?php
  990.     }
  991.     /*------------- HEADER MOBILE END -------------*/
  992.  
  993.     /*------------- HEADER MENUS START -------------*/
  994.     register_nav_menus(
  995.         array(
  996.             'mainmenu' => esc_html__( 'Main Menu', 'esport' ),
  997.             'footermenu' => esc_html__( 'Copyright Menu', 'esport' ),
  998.         )
  999.     );
  1000.     /*------------- HEADER MENUS END -------------*/
  1001.  
  1002.     /*------------- HEADER LOGOS START -------------*/
  1003.     function esport_site_logo() {
  1004.         echo '<div class="header-logo">';
  1005.             $logo = ot_get_option( 'esport_logo' );
  1006.             $logo_height = ot_get_option( 'logo_height' ); if( !empty( $logo_height ) ) { $logo_height = 'height="' . esc_attr( $logo_height[0] ) . esc_attr( $logo_height[1] ) . '"'; }
  1007.             $logo_width = ot_get_option( 'logo_width' ); if( !empty( $logo_width ) ) { $logo_width = 'width="' . esc_attr( $logo_width[0] ) . esc_attr( $logo_width[1] ) . '"'; }
  1008.             if( !$logo == ""  ) {
  1009.                 echo '<div class="logo"><a href="' . esc_url( home_url( '/' ) ) . '" class="site-logo"><img alt="' . esc_html__( 'Logo', 'esport' ) . '" src="' . esc_url( ot_get_option( 'esport_logo' ) ) . '" ' . $logo_height . $logo_width . ' /></a></div>';
  1010.             } else {
  1011.                 echo '<div class="logo"><a href="' . esc_url( home_url( '/' ) ) . '" class="site-logo"><img alt="' . esc_html__( 'Logo', 'esport' ) . '" src="' . get_template_directory_uri() . '/assets/img/logo.png" /></a></div>';
  1012.             }
  1013.         echo '</div>';
  1014.     }
  1015.  
  1016.     function esport_site_alternative_logo() {
  1017.         echo '<div class="header-logo header-alternative-logo">';
  1018.             $logo = ot_get_option( 'esport_logo_alternative' );
  1019.             $logo_height = ot_get_option( 'logo_height' ); if( !empty( $logo_height ) ) { $logo_height = 'height="' . esc_attr( $logo_height[0] ) . esc_attr( $logo_height[1] ) . '"'; }
  1020.             $logo_width = ot_get_option( 'logo_width' ); if( !empty( $logo_width ) ) { $logo_width = 'width="' . esc_attr( $logo_width[0] ) . esc_attr( $logo_width[1] ) . '"'; }
  1021.             if( !$logo == ""  ) {
  1022.                 echo '<div class="logo"><a href="' . esc_url( home_url( '/' ) ) . '" class="site-logo"><img alt="' . esc_html__( 'Logo', 'esport' ) . '" src="' . esc_url( ot_get_option( 'esport_logo_alternative' ) ) . '" ' . $logo_height . $logo_width . ' /></a></div>';
  1023.             } else {
  1024.                 echo '<div class="logo"><a href="' . esc_url( home_url( '/' ) ) . '" class="site-logo"><img alt="' . esc_html__( 'Logo', 'esport' ) . '" src="' . get_template_directory_uri() . '/assets/img/logo-alternative.png" /></a></div>';
  1025.             }
  1026.         echo '</div>';
  1027.     }
  1028.     /*------------- HEADER LOGOS END -------------*/
  1029.  
  1030.     /*------------- HEADER MAIN ELEMENTS START -------------*/
  1031.     function esport_header_styles_main_elements() {
  1032.         $header_social_media = ot_get_option( 'header_social_media' );
  1033.         if( $header_social_media == 'on' or !$header_social_media == 'off' ) {
  1034.             echo esport_social_media_links();          
  1035.         }
  1036.         $header_search = ot_get_option( 'header_search' );
  1037.         $rand = rand( 0, 999999 );
  1038.         if( $header_search == 'on' or !$header_search == 'off' ) {
  1039.             echo '<div class="header-search">
  1040.                 <div class="header-search-content-wrapper">
  1041.                     <i class="fa fa-search"></i>
  1042.                     <div class="header-search-content">
  1043.                         <form role="search" method="get" id="esportsearchform-' . esc_attr( $rand ) . '" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
  1044.                             <div class="search-form-widget">
  1045.                                 <input type="text" value="' . esc_attr( get_search_query() ) . '" placeholder="' . esc_html__( 'Search', 'esport' ) . '" name="s" id="esport-search-form-' . esc_attr( $rand ) . '" class="searchform-text" />
  1046.                                 <button><i class="fa fa-search"></i></button>
  1047.                             </div>
  1048.                         </form>
  1049.                     </div>
  1050.                 </div>
  1051.             </div>';
  1052.         }
  1053.     }
  1054.     /*------------- HEADER MAIN ELEMENTS END -------------*/
  1055.  
  1056.     /*------------- SUB MENU CLASS START -------------*/
  1057.     class esport_walker extends Walker_Nav_Menu {
  1058.         /**
  1059.          * @see Walker::start_lvl()
  1060.          * @since 3.0.0
  1061.          *
  1062.          * @param string $output Passed by reference. Used to append additional content.
  1063.          * @param int $depth Depth of page. Used for padding.
  1064.          */
  1065.         public function start_lvl( &$output, $depth = 0, $args = array() ) {
  1066.             $indent = str_repeat( "\t", $depth );
  1067.             $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n";
  1068.         }
  1069.         /**
  1070.          * @see Walker::start_el()
  1071.          * @since 3.0.0
  1072.          *
  1073.          * @param string $output Passed by reference. Used to append additional content.
  1074.          * @param object $item Menu item data object.
  1075.          * @param int $depth Depth of menu item. Used for padding.
  1076.          * @param int $current_page Menu item ID.
  1077.          * @param object $args
  1078.          */
  1079.         function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
  1080.  
  1081.             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  1082.  
  1083.             $li_attributes = '';
  1084.             $class_names = $value = '';
  1085.  
  1086.             $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  1087.  
  1088.             //Add class and attribute to LI element that contains a submenu UL.
  1089.             if ($args->has_children){
  1090.                 $classes[]      = 'dropdown';
  1091.                 $li_attributes .= ' data-dropdown="dropdown"';
  1092.             }
  1093.             $classes[] = 'menu-item-' . $item->ID;
  1094.             //If we are on the current page, add the active class to that menu item.
  1095.             $classes[] = ($item->current) ? 'active' : '';
  1096.  
  1097.             //Make sure you still add all of the WordPress classes.
  1098.             $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
  1099.             $class_names = ' class="' . esc_attr( $class_names ) . '"';
  1100.  
  1101.             $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
  1102.             $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
  1103.  
  1104.             $output .= $indent . '<li' . $id . $value . $class_names . $li_attributes . '>';
  1105.  
  1106.             //Add attributes to link element.
  1107.             $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
  1108.             $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target     ) .'"' : '';
  1109.             $attributes .= ! empty( $item->xfn ) ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
  1110.             $attributes .= ! empty( $item->url ) ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
  1111.             $attributes .= ($args->has_children) ? ' class="dropdown-toggle disabled" data-toggle="dropdown"' : '';
  1112.  
  1113.             $item_output = $args->before;
  1114.             $item_output .= '<a'. $attributes .'>';
  1115.                 $item_output .= $args->link_before;
  1116.                 $item_output .= apply_filters( 'the_title', $item->title, $item->ID );
  1117.                 $item_output .= $args->link_after;
  1118.             $item_output .= ($args->has_children) ? '<i class="fa fa-angle-down" aria-hidden="true"></i>' : '';
  1119.             $item_output .= '</a>';
  1120.             $item_output .= $args->after;
  1121.  
  1122.             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  1123.         }
  1124.         /**
  1125.          * Traverse elements to create list from elements.
  1126.          *
  1127.          * Display one element if the element doesn't have any children otherwise,
  1128.          * display the element and its children. Will only traverse up to the max
  1129.          * depth and no ignore elements under that depth.
  1130.          *
  1131.          * This method shouldn't be called directly, use the walk() method instead.
  1132.          *
  1133.          * @see Walker::start_el()
  1134.          * @since 2.5.0
  1135.          *
  1136.          * @param object $element Data object
  1137.          * @param array $children_elements List of elements to continue traversing.
  1138.          * @param int $max_depth Max depth to traverse.
  1139.          * @param int $depth Depth of current element.
  1140.          * @param array $args
  1141.          * @param string $output Passed by reference. Used to append additional content.
  1142.          * @return null Null on failure with no changes to parameters.
  1143.          */
  1144.         public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
  1145.             if ( ! $element )
  1146.                 return;
  1147.             $id_field = $this->db_fields['id'];
  1148.             // Display this element.
  1149.             if ( is_object( $args[0] ) )
  1150.                $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
  1151.             parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
  1152.         }
  1153.     }
  1154.     /*------------- SUB MENU CLASS END -------------*/
  1155.  
  1156.     /*------------- HEADER USERBOX CONTENT START -------------*/
  1157.     function esport_userbox() {
  1158.         $header_user_box = ot_get_option( 'header_user_box' );
  1159.         $header_social_login_system = ot_get_option( 'header_social_login_system' );
  1160.         if( !$header_user_box == 'off' or $header_user_box == 'on' ) {
  1161.             if( ! is_user_logged_in() ){
  1162.                 ?>
  1163.                 <div class="modal fade pt-user-modal" id="user_login_popup" tabindex="-1" role="dialog" aria-hidden="true">
  1164.                     <div class="modal-dialog">
  1165.                         <div class="modal-content">
  1166.                             <div class="user-box">
  1167.                                 <div class="user-box-login">
  1168.                                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">X</span></button>
  1169.                                     <div class="pt-login">
  1170.                                         <form id="pt_login_form" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="post">
  1171.                                             <div class="form-group">
  1172.                                                 <input class="required" name="pt_user_login" type="text" placeholder="<?php echo esc_html__('Username', 'esport') ?>" />
  1173.                                             </div>
  1174.                                             <div class="form-group">
  1175.                                                 <input class="required" name="pt_user_pass" id="pt_user_pass" type="password" placeholder="<?php echo esc_html__('Password', 'esport')?>" />
  1176.                                             </div>
  1177.                                             <div class="form-group login-form-remember-me">
  1178.                                                 <div class="login-remember-me-wrapper">
  1179.                                                     <input type="checkbox" value="None" id="login-remember-me-wrapper-input" name="pt_remember_me" />
  1180.                                                     <label for="login-remember-me-wrapper-input" id="login-remember-me-wrapper-label"><?php echo esc_html__('Remember Me', 'esport')?></label>
  1181.                                                 </div>
  1182.                                             </div>
  1183.                                             <div class="form-group login-form-button">
  1184.                                                 <input type="hidden" name="action" value="esport_login_member"/>
  1185.                                                 <button data-loading-text="<?php echo esc_html__('Loading...', 'esport') ?>" type="submit"><?php echo esc_html__('Sign in', 'esport'); ?></button>
  1186.                                             </div>
  1187.                                             <div class="bottom-links">
  1188.                                             <a href="<?php echo wp_lostpassword_url( get_permalink() ); ?>"><?php echo esc_html__('Lost Password?', 'esport') ?></a>
  1189.                                             <a href="" data-target="#user_register_popup" data-toggle="modal" class="create-an-account" data-dismiss="modal"><?php echo esc_html__('Create an Account', 'esport') ?></a>
  1190.                                             </div>
  1191.                                             <?php wp_nonce_field( 'ajax-login-nonce', 'login-security' ); ?>
  1192.                                         </form>
  1193.                                         <div class="pt-errors"></div>
  1194.                                     </div>
  1195.                                     <div class="pt-loading">
  1196.                                         <p><i class="fa fa-refresh fa-spin"></i><br><?php echo esc_html__('Loading...', 'esport') ?></p>
  1197.                                     </div>
  1198.                                 </div>
  1199.                             </div>
  1200.                         </div>
  1201.                     </div>
  1202.                 </div>
  1203.  
  1204.                 <div class="modal fade pt-user-modal" id="user_register_popup" tabindex="-1" role="dialog" aria-hidden="true">
  1205.                     <div class="modal-dialog modal-lg">
  1206.                         <div class="modal-content">
  1207.                             <div class="user-box">
  1208.                                 <div class="user-box-login">
  1209.                                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">X</span></button>
  1210.                                     <div class="pt-register">
  1211.                                         <?php
  1212.                                             if( get_option("users_can_register") == "0" ) {
  1213.                                                 echo '<p class="users_can_register">' . esc_html__( 'New membership are not allowed.', 'esport' ) . '</p>';
  1214.                                             } else {
  1215.                                         ?>
  1216.                                         <form id="pt_registration_form" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="POST">
  1217.                                             <div class="form-group">
  1218.                                                 <input class="required" name="pt_user_login" placeholder="<?php echo esc_html__('Username', 'esport'); ?>" type="text"/>
  1219.                                             </div>
  1220.                                             <div class="form-group">
  1221.                                                 <input class="required" name="pt_user_email" id="pt_user_email" placeholder="<?php echo esc_html__('Email', 'esport'); ?>" type="email"/>
  1222.                                             </div>
  1223.                                             <div class="form-group login-form-remember-me">
  1224.                                                 <div class="login-remember-me-wrapper">
  1225.                                                     <div class="description">
  1226.                                                         <?php
  1227.                                                             $page_terms_and_conditions = ot_get_option( 'page_terms_and_conditions' );
  1228.                                                             if( !empty( $page_terms_and_conditions ) ) {
  1229.                                                                 $page_terms_and_conditions = get_the_permalink( $page_terms_and_conditions );
  1230.                                                             } else {
  1231.                                                                 $page_terms_and_conditions = home_url( '/' );
  1232.                                                             }
  1233.  
  1234.                                                             $page_privacy_policy = ot_get_option( 'page_privacy_policy' );
  1235.                                                             if( !empty( $page_privacy_policy ) ) {
  1236.                                                                 $page_privacy_policy = get_the_permalink( $page_privacy_policy );
  1237.                                                             } else {
  1238.                                                                 $page_privacy_policy = home_url( '/' );
  1239.                                                             }
  1240.                                                         ?>
  1241.                                                         <?php echo esc_html__('By creating an account you agree to our', 'esport' ); ?>
  1242.                                                         <a href="<?php echo esc_url( $page_terms_and_conditions ); ?>" target="_blank"><?php echo esc_html__('terms and conditions', 'esport' ); ?></a>
  1243.                                                         <?php echo esc_html__('and our', 'esport' ); ?>
  1244.                                                         <a href="<?php echo esc_url( $page_privacy_policy ); ?>" target="_blank"><?php echo esc_html__('privacy policy.', 'esport' ); ?></a>
  1245.                                                     </div>
  1246.                                                 </div>
  1247.                                             </div>
  1248.                                             <div class="form-group login-form-button register-form-button">
  1249.                                                 <input type="hidden" name="action" value="esport_register_member"/>
  1250.                                                 <button data-loading-text="<?php echo esc_html__('Loading...', 'esport') ?>" type="submit"><?php echo esc_html__('Be Member', 'esport'); ?></button>
  1251.                                             </div>
  1252.                                             <?php wp_nonce_field( 'ajax-login-nonce', 'register-security' ); ?>
  1253.                                         </form>
  1254.                                         <div class="pt-errors"></div>
  1255.                                         <?php } ?>
  1256.                                     </div>
  1257.                                 </div>
  1258.                             </div>
  1259.                         </div>
  1260.                     </div>
  1261.                 </div>
  1262.             <?php
  1263.             }
  1264.         }
  1265.     }
  1266.     add_action( 'wp_footer', 'esport_userbox' );
  1267.  
  1268.     function esport_login_member(){
  1269.         $user_login = $_POST['pt_user_login']; 
  1270.         $user_pass = $_POST['pt_user_pass'];
  1271.         $remember = $_POST['pt_remember_me'];
  1272.         if(isset($_POST['pt_remember_me'])) {
  1273.             $remember_me = "true";
  1274.         } else {
  1275.             $remember_me = "false";
  1276.         }
  1277.  
  1278.         if( !check_ajax_referer( 'ajax-login-nonce', 'login-security', false ) ){
  1279.             echo json_encode( array( 'error' => true, 'message' => '<div class="alert-no">' . esc_html__('Session token has expired, please reload the page and try again.', 'esport') . '</div>' ) );
  1280.         }
  1281.         elseif( empty( $user_login ) || empty( $user_pass ) ){
  1282.             echo json_encode( array( 'error' => true, 'message' => '<div class="alert-no">' . esc_html__('Please fill all form fields.', 'esport' ) . '</div>' ) );
  1283.         } else {
  1284.             $user = wp_signon( array( 'user_login' => $user_login, 'user_password' => $user_pass, 'remember' => $remember_me ), false );
  1285.             if( is_wp_error( $user ) ){
  1286.                 echo json_encode( array( 'error' => true, 'message' => '<div class="alert-no">' . $user->get_error_message() . '</div>' ) );
  1287.             } else{
  1288.                 echo json_encode( array( 'error' => false, 'message' => '<div class="alert-ok">' . esc_html__('Login successful, you are being redirected.', 'esport') . '</div>' ) );
  1289.             }
  1290.         }
  1291.         die();
  1292.     }
  1293.     add_action( 'wp_ajax_nopriv_esport_login_member', 'esport_login_member' );
  1294.  
  1295.     function esport_register_member(){
  1296.             $user_login = $_POST['pt_user_login']; 
  1297.             $user_email = $_POST['pt_user_email'];
  1298.            
  1299.             if( !check_ajax_referer( 'ajax-login-nonce', 'register-security', false ) ){
  1300.                 echo json_encode( array( 'error' => true, 'message' => '<div class="alert-no">' . esc_html__( 'Session token has expired, please reload the page and try again', 'esport' ).'</div>' ) );
  1301.                 die();
  1302.             }
  1303.            
  1304.             elseif( empty( $user_login ) || empty( $user_email ) ){
  1305.                 echo json_encode( array( 'error' => true, 'message' => '<div class="alert-no">' . esc_html__( 'Please fill all form fields', 'esport' ) . '</div>' ) );
  1306.                 die();
  1307.             }
  1308.            
  1309.             $errors = register_new_user($user_login, $user_email);
  1310.             if( is_wp_error( $errors ) ){
  1311.                 $registration_error_messages = $errors->errors;
  1312.                 $display_errors = '<div class="alert alert-no">';
  1313.                     foreach( $registration_error_messages as $error ){
  1314.                         $display_errors .= '<p>' . $error[0] . '</p>';
  1315.                     }
  1316.                 $display_errors .= '</div>';
  1317.                 echo json_encode( array( 'error' => true, 'message' => $display_errors ) );
  1318.             } else {
  1319.                 echo json_encode( array( 'error' => false, 'message' => '<div class="alert-ok">' . esc_html__( 'Registration completed. Please check your e-mail.', 'esport' ) . '</p>' ) );
  1320.             }
  1321.             die();
  1322.     }
  1323.     add_action( 'wp_ajax_nopriv_esport_register_member', 'esport_register_member' );
  1324.     /*------------- HEADER USERBOX CONTENT END -------------*/
  1325. /*------------- HEADER END -------------*/
  1326.  
  1327. /*------------- SOCIAL MEDIA START -------------*/
  1328.     /*------------- SOCIAL MEDIA LINKS TEMPLATE START -------------*/
  1329.     function esport_social_media_links() {
  1330.         $output = '';
  1331.         $output .='<ul class="social-links">';
  1332.             if( !ot_get_option( 'social_media_facebook' ) == ""  ) :
  1333.                 $output .='<li><a href="' . ot_get_option( 'social_media_facebook' ) . '" class="facebook" title="' . esc_html__( 'Facebook', 'esport' ) . '" target="_blank"><i class="fa fa-facebook"></i></a></li>';
  1334.             endif;
  1335.  
  1336.             if( !ot_get_option( 'social_media_twitter' ) == ""  ) :
  1337.                 $output .='<li><a href="' . ot_get_option( 'social_media_twitter' ) . '" class="twitter" title="' . esc_html__( 'Twitter', 'esport' ) . '" target="_blank"><i class="fa fa-twitter"></i></a></li>';
  1338.             endif;
  1339.  
  1340.             if( !ot_get_option( 'social_media_googleplus' ) == ""  ) :
  1341.                 $output .='<li><a href="' . ot_get_option( 'social_media_googleplus' ) . '" class="googleplus" title="' . esc_html__( 'Google+', 'esport' ) . '" target="_blank"><i class="fa fa-google-plus"></i></a></li>';
  1342.             endif;
  1343.  
  1344.             if( !ot_get_option( 'social_media_instagram' ) == ""  ) :
  1345.                 $output .='<li><a href="' . ot_get_option( 'social_media_instagram' ) . '" class="instagram" title="' . esc_html__( 'Instagram', 'esport' ) . '" target="_blank"><i class="fa fa-instagram"></i></a></li>';
  1346.             endif;
  1347.  
  1348.             if( !ot_get_option( 'social_media_linkedin' ) == ""  ) :
  1349.                 $output .='<li><a href="' . ot_get_option( 'social_media_linkedin' ) . '" class="linkedin" title="' . esc_html__( 'Linkedin', 'esport' ) . '" target="_blank"><i class="fa fa-linkedin"></i></a></li>';
  1350.             endif;
  1351.  
  1352.             if( !ot_get_option( 'social_media_vine' ) == ""  ) :
  1353.                 $output .='<li><a href="' . ot_get_option( 'social_media_vine' ) . '" class="vine" title="' . esc_html__( 'Vine', 'esport' ) . '" target="_blank"><i class="fa fa-vine"></i></a></li>';
  1354.             endif;
  1355.  
  1356.             if( !ot_get_option( 'social_media_youtube' ) == ""  ) :
  1357.                 $output .='<li><a href="' . ot_get_option( 'social_media_youtube' ) . '" class="youtube" title="' . esc_html__( 'YouTube', 'esport' ) . '" target="_blank"><i class="fa fa-youtube"></i></a></li>';
  1358.             endif;
  1359.  
  1360.             if( !ot_get_option( 'social_media_twitch' ) == ""  ) :
  1361.                 $output .='<li><a href="' . ot_get_option( 'social_media_twitch' ) . '" class="twitch" title="' . esc_html__( 'Twitch', 'esport' ) . '" target="_blank"><i class="fa fa-twitch"></i></a></li>';
  1362.             endif;
  1363.  
  1364.             if( !ot_get_option( 'social_media_pinterest' ) == ""  ) :
  1365.                 $output .='<li><a href="' . ot_get_option( 'social_media_pinterest' ) . '" class="pinterest" title="' . esc_html__( 'Pinterest', 'esport' ) . '" target="_blank"><i class="fa fa-pinterest"></i></a></li>';
  1366.             endif;
  1367.  
  1368.             if( !ot_get_option( 'social_media_behance' ) == ""  ) :
  1369.                 $output .='<li><a href="' . ot_get_option( 'social_media_behance' ) . '" class="behance" title="' . esc_html__( 'Behance', 'esport' ) . '" target="_blank"><i class="fa fa-behance"></i></a></li>';
  1370.             endif;
  1371.  
  1372.             if( !ot_get_option( 'social_media_deviantart' ) == ""  ) :
  1373.                 $output .='<li><a href="' . ot_get_option( 'social_media_deviantart' ) . '" class="deviantart" title="' . esc_html__( 'Deviantart', 'esport' ) . '" target="_blank"><i class="fa fa-deviantart"></i></a></li>';
  1374.             endif;
  1375.  
  1376.             if( !ot_get_option( 'social_media_digg' ) == ""  ) :
  1377.                 $output .='<li><a href="' . ot_get_option( 'social_media_digg' ) . '" class="digg" title="' . esc_html__( 'Digg', 'esport' ) . '" target="_blank"><i class="fa fa-digg"></i></a></li>';
  1378.             endif;
  1379.  
  1380.             if( !ot_get_option( 'social_media_dribbble' ) == ""  ) :
  1381.                 $output .='<li><a href="' . ot_get_option( 'social_media_dribbble' ) . '" class="dribbble" title="' . esc_html__( 'Dribbble', 'esport' ) . '" target="_blank"><i class="fa fa-dribbble"></i></a></li>';
  1382.             endif;
  1383.  
  1384.             if( !ot_get_option( 'social_media_flickr' ) == ""  ) :
  1385.                 $output .='<li><a href="' . ot_get_option( 'social_media_flickr' ) . '" class="flickr" title="' . esc_html__( 'Flickr', 'esport' ) . '" target="_blank"><i class="fa fa-flickr"></i></a></li>';
  1386.             endif;
  1387.  
  1388.             if( !ot_get_option( 'social_media_github' ) == ""  ) :
  1389.                 $output .='<li><a href="' . ot_get_option( 'social_media_github' ) . '" class="github"" title="' . esc_html__( 'GitHub', 'esport' ) . '" target="_blank"><i class="fa fa-github"></i></a></li>';
  1390.             endif;
  1391.  
  1392.             if( !ot_get_option( 'social_media_lastfm' ) == ""  ) :
  1393.                 $output .='<li><a href="' . ot_get_option( 'social_media_lastfm' ) . '" class="lastfm" title="' . esc_html__( 'Last.fm', 'esport' ) . '" target="_blank"><i class="fa fa-lastfm"></i></a></li>';
  1394.             endif;
  1395.  
  1396.             if( !ot_get_option( 'social_media_reddit' ) == ""  ) :
  1397.                 $output .='<li><a href="' . ot_get_option( 'social_media_reddit' ) . '" class="reddit" title="' . esc_html__( 'Reddit', 'esport' ) . '" target="_blank"><i class="fa fa-reddit"></i></a></li>';
  1398.             endif;
  1399.  
  1400.             if( !ot_get_option( 'social_media_soundcloud' ) == ""  ) :
  1401.                 $output .='<li><a href="' . ot_get_option( 'social_media_soundcloud' ) . '" class="soundcloud" title="' . esc_html__( 'SoundCloud', 'esport' ) . '" target="_blank"><i class="fa fa-soundcloud"></i></a></li>';
  1402.             endif;
  1403.  
  1404.             if( !ot_get_option( 'social_media_tumblr' ) == ""  ) :
  1405.                 $output .='<li><a href="' . ot_get_option( 'social_media_tumblr' ) . '" class="tumblr" title="' . esc_html__( 'Tumblr', 'esport' ) . '" target="_blank"><i class="fa fa-tumblr"></i></a></li>';
  1406.             endif;
  1407.  
  1408.             if( !ot_get_option( 'social_media_vimeo' ) == ""  ) :
  1409.                 $output .='<li><a href="' . ot_get_option( 'social_media_vimeo' ) . '" class="vimeo" title="' . esc_html__( 'Vimeo', 'esport' ) . '" target="_blank"><i class="fa fa-vimeo"></i></a></li>';
  1410.             endif;
  1411.  
  1412.             if( !ot_get_option( 'social_media_vk' ) == ""  ) :
  1413.                 $output .='<li><a href="' . ot_get_option( 'social_media_vk' ) . '" class="vk" title="' . esc_html__( 'VK', 'esport' ) . '" target="_blank"><i class="fa fa-vk"></i></a></li>';
  1414.             endif;
  1415.  
  1416.             if( !ot_get_option( 'social_media_medium' ) == ""  ) :
  1417.                 $output .='<li><a href="' . ot_get_option( 'social_media_medium' ) . '" class="medium" title="' . esc_html__( 'Medium', 'esport' ) . '" target="_blank"><i class="fa fa-medium"></i></a></li>';
  1418.             endif;
  1419.  
  1420.             if( !ot_get_option( 'social_media_rss' ) == ""  ) :
  1421.                 $output .='<li><a href="' . ot_get_option( 'social_media_rss' ) . '" class="rss" title="' . esc_html__( 'RSS', 'esport' ) . '" target="_blank"><i class="fa fa-rss"></i></a></li>';
  1422.             endif;
  1423.         $output .='</ul>';
  1424.         return stripslashes( addslashes( $output ) );
  1425.     }
  1426.     /*------------- SOCIAL MEDIA LINKS TEMPLATE END -------------*/
  1427.  
  1428.     /*------------- POST SOCIAL SHARE TEMPLATE START -------------*/
  1429.     function esport_general_post_social_share() {
  1430.         $social_share_facebook = ot_get_option( 'social_share_facebook' );
  1431.         $social_share_twitter = ot_get_option( 'social_share_twitter' );
  1432.         $social_share_googleplus = ot_get_option( 'social_share_googleplus' );
  1433.         $social_share_linkedin = ot_get_option( 'social_share_linkedin' );
  1434.         $social_share_pinterest = ot_get_option( 'social_share_pinterest' );
  1435.         $social_share_reddit = ot_get_option( 'social_share_reddit' );
  1436.         $social_share_delicious = ot_get_option( 'social_share_delicious' );
  1437.         $social_share_stumbleupon = ot_get_option( 'social_share_stumbleupon' );
  1438.         $social_share_tumblr = ot_get_option( 'social_share_tumblr' );
  1439.         $social_share_link_title = esc_html__( 'Share to', 'esport' );
  1440.         $hide_general_post_share = ot_get_option( 'hide_general_post_share' );
  1441.         $share_post_id = get_the_ID();
  1442.        
  1443.         $facebook = "";
  1444.         $twitter = "";
  1445.         $googleplus = "";
  1446.         $linkedin = "";
  1447.         $pinterest = "";   
  1448.         $reddit = "";
  1449.         $delicious = "";
  1450.         $stumbleupon = "";
  1451.         $tumblr = "";
  1452.        
  1453.         if( !$hide_general_post_share == 'off' or $hide_general_post_share == "on" ) {
  1454.  
  1455.             if( !$social_share_facebook == 'off' or $social_share_facebook == 'on' ) {
  1456.                 $facebook = '<li><a class="share-facebook"  href="https://www.facebook.com/sharer/sharer.php?u=' . get_the_permalink() . '&t=' . urlencode( get_the_title() ) . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Facebook', 'esport' ) . '" target="_blank"><i class="fa fa-facebook"></i>' . '<span>' . esc_html__( 'Facebook', 'esport' ) . '</span>' . '</a></li>';
  1457.             }
  1458.  
  1459.             if( !$social_share_twitter == 'off' or $social_share_twitter == 'on' ) {
  1460.                 $twitter = '<li><a class="share-twitter"  href="https://twitter.com/intent/tweet?url=' . get_the_permalink() . '&text=' . urlencode( get_the_title() ). '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Twitter', 'esport' ) . '" target="_blank"><i class="fa fa-twitter"></i>' . '<span>' . esc_html__( 'Twitter', 'esport' ) . '</span>' . '</a></li>';
  1461.             }
  1462.  
  1463.             if( !$social_share_googleplus == 'off' or $social_share_googleplus == 'on' ) {
  1464.                 $googleplus = '<li><a class="share-googleplus"  href="https://plus.google.com/share?url=' . get_the_permalink() . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Google+', 'esport' ) . '" target="_blank"><i class="fa fa-google-plus"></i>' . '<span>' . esc_html__( 'Google+', 'esport' ) . '</span>' . '</a></li>';
  1465.             }
  1466.  
  1467.             if( !$social_share_linkedin == 'off' or $social_share_linkedin == 'on' ) {
  1468.                 $linkedin = '<li><a class="share-linkedin"  href="https://www.linkedin.com/shareArticle?mini=true&amp;url=' . get_the_permalink() . '&title=' . urlencode( get_the_title() ) . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Linkedin', 'esport' ) . '" target="_blank"><i class="fa fa-linkedin"></i>' . '<span>' . esc_html__( 'LinkedIn', 'esport' ) . '</span>' . '</a></li>';
  1469.             }
  1470.  
  1471.             if( !$social_share_pinterest == 'off' or $social_share_pinterest == 'on' ) {
  1472.                 $pinterest = '<li><a class="share-pinterest"  href="https://pinterest.com/pin/create/button/?url=' . get_the_permalink() . '&description=' . urlencode( get_the_title() ) . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Pinterest', 'esport' ) . '" target="_blank"><i class="fa fa-pinterest-p"></i>' . '<span>' . esc_html__( 'Pinterest', 'esport' ) . '</span>' . '</a></li>';
  1473.             }
  1474.  
  1475.             if( !$social_share_reddit == 'off' or $social_share_reddit == 'on' ) {
  1476.                 $reddit = '<li><a class="share-reddit"  href="http://reddit.com/submit?url=' . get_the_permalink() . '&title=' . urlencode( get_the_title() ) . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Reddit', 'esport' ) . '" target="_blank"><i class="fa fa-reddit"></i>' . '<span>' . esc_html__( 'Reddit', 'esport' ) . '</span>' . '</a></li>';
  1477.             }
  1478.  
  1479.             if( !$social_share_delicious == 'off' or $social_share_delicious == 'on' ) {
  1480.                 $delicious = '<li><a class="share-delicious"  href="http://del.icio.us/post?url=' . get_the_permalink() . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Delicious', 'esport' ) . '" target="_blank"><i class="fa fa-delicious"></i>' . '<span>' . esc_html__( 'Delicious', 'esport' ) . '</span>' . '</a></li>';
  1481.             }
  1482.  
  1483.             if( !$social_share_stumbleupon == 'off' or $social_share_stumbleupon == 'on' ) {
  1484.                 $stumbleupon = '<li><a class="share-stumbleupon"  href="http://www.stumbleupon.com/submit?url=' . get_the_permalink() . '&title=' . get_the_title() . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Stumbleupon', 'esport' ) . '" target="_blank"><i class="fa fa-stumbleupon"></i>' . '<span>' . esc_html__( 'Stumbleupon', 'esport' ) . '</span>' . '</a></li>';
  1485.             }
  1486.  
  1487.             if( !$social_share_tumblr == 'off' or $social_share_tumblr == 'on' ) {
  1488.                 $tumblr = '<li><a class="share-tumblr"  href="http://www.tumblr.com/share/link?url=' . get_the_permalink() . '" title="' . esc_attr( $social_share_link_title ) . esc_html__( 'Tumblr', 'esport' ) . '" target="_blank"><i class="fa fa-tumblr"></i>' . '<span>' . esc_html__( 'Tumblr', 'esport' ) . '</span>' . '</a></li>';
  1489.             }
  1490.         }
  1491.        
  1492.         $before = '<div class="post-share"><ul>';
  1493.         $after = '</ul></div>';
  1494.        
  1495.         $output = $before . $facebook . $twitter . $googleplus . $linkedin . $pinterest . $reddit . $delicious . $stumbleupon . $tumblr . $after;
  1496.         return stripslashes( addslashes( $output ) );
  1497.     }
  1498.     /*------------- POST SOCIAL SHARE TEMPLATE END -------------*/
  1499.  
  1500.     /*------------- USER PROFILE SOCIAL MEDIA START -------------*/
  1501.     function esport_user_profile_social_media_links( $user_id = "" ) {
  1502.         $user_profile_social_media_facebook = get_the_author_meta( 'facebook', $user_id );
  1503.         $user_profile_social_media_googleplus = get_the_author_meta( 'googleplus', $user_id );
  1504.         $user_profile_social_media_instagram = get_the_author_meta( 'instagram', $user_id );
  1505.         $user_profile_social_media_linkedin = get_the_author_meta( 'linkedin', $user_id );
  1506.         $user_profile_social_media_vine = get_the_author_meta( 'vine', $user_id );
  1507.         $user_profile_social_media_twitter = get_the_author_meta( 'twitter', $user_id );
  1508.         $user_profile_social_media_pinterest = get_the_author_meta( 'pinterest', $user_id );
  1509.         $user_profile_social_media_youtube = get_the_author_meta( 'youtube', $user_id );
  1510.         $user_profile_social_media_behance = get_the_author_meta( 'behance', $user_id );
  1511.         $user_profile_social_media_deviantart = get_the_author_meta( 'deviantart', $user_id );
  1512.         $user_profile_social_media_digg = get_the_author_meta( 'digg', $user_id );
  1513.         $user_profile_social_media_dribbble = get_the_author_meta( 'dribbble', $user_id );
  1514.         $user_profile_social_media_flickr = get_the_author_meta( 'flickr', $user_id );
  1515.         $user_profile_social_media_github = get_the_author_meta( 'github', $user_id );
  1516.         $user_profile_social_media_lastfm = get_the_author_meta( 'lastfm', $user_id );
  1517.         $user_profile_social_media_reddit = get_the_author_meta( 'reddit', $user_id );
  1518.         $user_profile_social_media_soundcloud = get_the_author_meta( 'soundcloud', $user_id );
  1519.         $user_profile_social_media_tumblr = get_the_author_meta( 'tumblr', $user_id );
  1520.         $user_profile_social_media_vimeo = get_the_author_meta( 'vimeo', $user_id );
  1521.         $user_profile_social_media_vk = get_the_author_meta( 'vk', $user_id );
  1522.         $user_profile_social_media_medium = get_the_author_meta( 'medium', $user_id );
  1523.  
  1524.         if( !$user_profile_social_media_medium == "" or !$user_profile_social_media_vk == "" or !$user_profile_social_media_vimeo == "" or !$user_profile_social_media_tumblr == "" or !$user_profile_social_media_soundcloud == "" or !$user_profile_social_media_reddit == "" or !$user_profile_social_media_lastfm == "" or !$user_profile_social_media_github == "" or !$user_profile_social_media_flickr == "" or !$user_profile_social_media_dribbble == "" or !$user_profile_social_media_digg == "" or !$user_profile_social_media_deviantart == "" or !$user_profile_social_media_behance == "" or !$user_profile_social_media_youtube == "" or !$user_profile_social_media_pinterest == "" or !$user_profile_social_media_twitter == "" or !$user_profile_social_media_vine == "" or !$user_profile_social_media_linkedin == "" or !$user_profile_social_media_facebook == "" or !$user_profile_social_media_googleplus == ""  or !$user_profile_social_media_instagram == "" ) { ?>
  1525.  
  1526.             <div class="author-social-links">
  1527.                 <ul>
  1528.                     <?php if( !$user_profile_social_media_facebook == ""  ) : ?>
  1529.                         <li><a href="<?php echo esc_url( $user_profile_social_media_facebook ); ?>" title="<?php echo esc_html__( 'Facebook', 'esport' ); ?>" target="_blank" class="facebook"><i class="fa fa-facebook"></i></a></li>
  1530.                     <?php endif; ?>
  1531.                    
  1532.                     <?php if( !$user_profile_social_media_googleplus == ""  ) : ?>
  1533.                         <li><a href="<?php echo esc_url( $user_profile_social_media_googleplus ); ?>" title="<?php echo esc_html__( 'Google+', 'esport' ); ?>" target="_blank" class="googleplus"><i class="fa fa-google-plus"></i></a></li>
  1534.                     <?php endif; ?>
  1535.                    
  1536.                     <?php if( !$user_profile_social_media_instagram == ""  ) : ?>
  1537.                         <li><a href="<?php echo esc_url( $user_profile_social_media_instagram ); ?>" title="<?php echo esc_html__( 'Instagram', 'esport' ); ?>" target="_blank" class="instagram"><i class="fa fa-instagram"></i></a></li>
  1538.                     <?php endif; ?>
  1539.                    
  1540.                     <?php if( !$user_profile_social_media_linkedin == ""  ) : ?>
  1541.                         <li><a href="<?php echo esc_url( $user_profile_social_media_linkedin ); ?>" title="<?php echo esc_html__( 'LinkedIn', 'esport' ); ?>" target="_blank" class="linkedin"><i class="fa fa-linkedin"></i></a></li>
  1542.                     <?php endif; ?>
  1543.                    
  1544.                     <?php if( !$user_profile_social_media_vine == ""  ) : ?>
  1545.                         <li><a href="<?php echo esc_url( $user_profile_social_media_vine ); ?>" title="<?php echo esc_html__( 'Vine', 'esport' ); ?>" target="_blank" class="vine"><i class="fa fa-vine"></i></a></li>
  1546.                     <?php endif; ?>
  1547.                    
  1548.                     <?php if( !$user_profile_social_media_twitter == ""  ) : ?>
  1549.                         <li><a href="<?php echo esc_url( $user_profile_social_media_twitter ); ?>" title="<?php echo esc_html__( 'Twitter', 'esport' ); ?>" target="_blank" class="twitter"><i class="fa fa-twitter"></i></a></li>
  1550.                     <?php endif; ?>
  1551.                    
  1552.                     <?php if( !$user_profile_social_media_pinterest == ""  ) : ?>
  1553.                         <li><a href="<?php echo esc_url( $user_profile_social_media_pinterest ); ?>" title="<?php echo esc_html__( 'Pinterest', 'esport' ); ?>" target="_blank" class="pinterest"><i class="fa fa-pinterest"></i></a></li>
  1554.                     <?php endif; ?>
  1555.                    
  1556.                     <?php if( !$user_profile_social_media_youtube == ""  ) : ?>
  1557.                         <li><a href="<?php echo esc_url( $user_profile_social_media_youtube ); ?>" title="<?php echo esc_html__( 'YouTube', 'esport' ); ?>" target="_blank" class="youtube"><i class="fa fa-youtube"></i></a></li>
  1558.                     <?php endif; ?>
  1559.                    
  1560.                     <?php if( !$user_profile_social_media_behance == ""  ) : ?>
  1561.                         <li><a href="<?php echo esc_url( $user_profile_social_media_behance ); ?>" title="<?php echo esc_html__( 'Behance', 'esport' ); ?>" target="_blank" class="behance"><i class="fa fa-behance"></i></a></li>
  1562.                     <?php endif; ?>
  1563.                    
  1564.                     <?php if( !$user_profile_social_media_deviantart == ""  ) : ?>
  1565.                         <li><a href="<?php echo esc_url( $user_profile_social_media_deviantart ); ?>" title="<?php echo esc_html__( 'DeviantArt', 'esport' ); ?>" target="_blank" class="deviantart"><i class="fa fa-deviantart"></i></a></li>
  1566.                     <?php endif; ?>
  1567.                    
  1568.                     <?php if( !$user_profile_social_media_digg == ""  ) : ?>
  1569.                         <li><a href="<?php echo esc_url( $user_profile_social_media_digg ); ?>" title="<?php echo esc_html__( 'Digg', 'esport' ); ?>" target="_blank" class="digg"><i class="fa fa-digg"></i></a></li>
  1570.                     <?php endif; ?>
  1571.                    
  1572.                     <?php if( !$user_profile_social_media_dribbble == ""  ) : ?>
  1573.                         <li><a href="<?php echo esc_url( $user_profile_social_media_dribbble ); ?>" title="<?php echo esc_html__( 'Dribbble', 'esport' ); ?>" target="_blank" class="dribbble"><i class="fa fa-dribbble"></i></a></li>
  1574.                     <?php endif; ?>
  1575.                    
  1576.                     <?php if( !$user_profile_social_media_flickr == ""  ) : ?>
  1577.                         <li><a href="<?php echo esc_url( $user_profile_social_media_flickr ); ?>" title="<?php echo esc_html__( 'Flickr', 'esport' ); ?>" target="_blank" class="flickr"><i class="fa fa-flickr"></i></a></li>
  1578.                     <?php endif; ?>
  1579.                    
  1580.                     <?php if( !$user_profile_social_media_github == ""  ) : ?>
  1581.                         <li><a href="<?php echo esc_url( $user_profile_social_media_github ); ?>" title="<?php echo esc_html__( 'GitHub', 'esport' ); ?>" target="_blank" class="github"><i class="fa fa-github"></i></a></li>
  1582.                     <?php endif; ?>
  1583.                    
  1584.                     <?php if( !$user_profile_social_media_lastfm == ""  ) : ?>
  1585.                         <li><a href="<?php echo esc_url( $user_profile_social_media_lastfm ); ?>" title="<?php echo esc_html__( 'Last.fm', 'esport' ); ?>" target="_blank" class="lastfm"><i class="fa fa-lastfm"></i></a></li>
  1586.                     <?php endif; ?>
  1587.                    
  1588.                     <?php if( !$user_profile_social_media_reddit == ""  ) : ?>
  1589.                         <li><a href="<?php echo esc_url( $user_profile_social_media_reddit ); ?>" title="<?php echo esc_html__( 'Reddit', 'esport' ); ?>" target="_blank" class="reddit"><i class="fa fa-reddit"></i></a></li>
  1590.                     <?php endif; ?>
  1591.                    
  1592.                     <?php if( !$user_profile_social_media_soundcloud == ""  ) : ?>
  1593.                         <li><a href="<?php echo esc_url( $user_profile_social_media_soundcloud ); ?>" title="<?php echo esc_html__( 'SoundCloud', 'esport' ); ?>" target="_blank" class="soundcloud"><i class="fa fa-soundcloud"></i></a></li>
  1594.                     <?php endif; ?>
  1595.                    
  1596.                     <?php if( !$user_profile_social_media_tumblr == ""  ) : ?>
  1597.                         <li><a href="<?php echo esc_url( $user_profile_social_media_tumblr ); ?>" title="<?php echo esc_html__( 'Tumblr', 'esport' ); ?>" target="_blank" class="tumblr"><i class="fa fa-tumblr"></i></a></li>
  1598.                     <?php endif; ?>
  1599.                    
  1600.                     <?php if( !$user_profile_social_media_vimeo == ""  ) : ?>
  1601.                         <li><a href="<?php echo esc_url( $user_profile_social_media_vimeo ); ?>" title="<?php echo esc_html__( 'Vimeo', 'esport' ); ?>" target="_blank" class="vimeo"><i class="fa fa-vimeo"></i></a></li>
  1602.                     <?php endif; ?>
  1603.                    
  1604.                     <?php if( !$user_profile_social_media_vk == ""  ) : ?>
  1605.                         <li><a href="<?php echo esc_url( $user_profile_social_media_vk ); ?>" title="<?php echo esc_html__( 'VK', 'esport' ); ?>" target="_blank" class="vk"><i class="fa fa-vk"></i></a></li>
  1606.                     <?php endif; ?>
  1607.                    
  1608.                     <?php if( !$user_profile_social_media_medium == ""  ) : ?>
  1609.                         <li><a href="<?php echo esc_url( $user_profile_social_media_medium ); ?>" title="<?php echo esc_html__( 'Medium', 'esport' ); ?>" target="_blank" class="medium"><i class="fa fa-medium"></i></a></li>
  1610.                     <?php endif; ?>
  1611.                 </ul>
  1612.             </div>
  1613.         <?php
  1614.         }
  1615.     }
  1616.     /*------------- USER PROFILE SOCIAL MEDIA END -------------*/
  1617. /*------------- SOCIAL SHARE END -------------*/
  1618.  
  1619. /*------------- SHOP START -------------*/
  1620.     /*------------- WOOCOMMERCE GENERAL START -------------*/
  1621.     if(class_exists('Woocommerce') ) {
  1622.         function esport_woocommerce_support() {
  1623.             add_theme_support( 'woocommerce' );
  1624.         }
  1625.         add_action( 'after_setup_theme', 'esport_woocommerce_support' );
  1626.     }
  1627.     /*------------- WOOCOMMERCE GENERAL END -------------*/
  1628.  
  1629.     /*------------- WOOCOMMERCE COLUMNS END -------------*/
  1630.     function esport_related_products_args( $args ) {
  1631.         $related_product_count = esc_attr( ot_get_option( 'woocommerce_related_product_count_column' ) );
  1632.         if( !empty( $related_product_count ) ) {
  1633.             $args['posts_per_page'] = $related_product_count;
  1634.             $args['columns'] = 4;
  1635.         } else {
  1636.             $args['posts_per_page'] = 4;
  1637.             $args['columns'] = 4;
  1638.         }
  1639.         return $args;
  1640.     }
  1641.     add_filter( 'woocommerce_output_related_products_args', 'esport_related_products_args' );
  1642.  
  1643.     if (!function_exists('esport_loop_columns')) {
  1644.         function esport_loop_columns() {
  1645.             $woocommerce_shop_product_column = esc_attr( ot_get_option( 'woocommerce_shop_product_column' ) );
  1646.             if( !empty( $woocommerce_shop_product_column ) ) {
  1647.                 return $woocommerce_shop_product_column;
  1648.             } else {
  1649.                 return 3;
  1650.             }
  1651.         }
  1652.     }
  1653.     add_filter('loop_shop_columns', 'esport_loop_columns');
  1654.     /*------------- WOOCOMMERCE COLUMNS START -------------*/
  1655.  
  1656.     /*------------- GENERAL SHOP BUY NOW LINK START -------------*/
  1657.     function esport_shop_buy_now( $product_id = "" ) {
  1658.         if( !empty( $product_id ) ) {
  1659.             $output = '<a href="' . get_the_permalink( $product_id ). '" class="more-button" title="' . the_title_attribute( array( 'echo' => 0,  'post' => $product_id ) ) . '">';
  1660.                 $output .= '<i class="fa fa-shopping-basket" aria-hidden="true"></i>';
  1661.                 $output .= '<span>' . esc_html__( 'Buy Now', 'esport' ) . '</span>';
  1662.             $output .= '</a>';
  1663.             return $output;
  1664.         }
  1665.     }
  1666.     /*------------- GENERAL SHOP BUY NOW LINK END -------------*/
  1667.  
  1668.     /*------------- GENERAL PRICE START -------------*/
  1669.     function esport_product_price( $product_id = "" ) {
  1670.         if( !empty( $product_id ) ) {
  1671.             global $product;
  1672.             $output = '<div class="price">' . stripslashes( addslashes( $product->get_price_html() ) ) . '</div>';
  1673.             return $output;
  1674.         }
  1675.     }
  1676.     /*------------- GENERAL PRICE END -------------*/
  1677. /*------------- SHOP END -------------*/
  1678.  
  1679. /*------------- POST LIST STYLES START -------------*/
  1680.     /*------------- POST LIST STYLE 1 START -------------*/
  1681.     function esport_post_list_style_1( $post_id = "", $image = "", $category = "", $excerpt = "", $read_more = "", $post_info = "" ) {
  1682.         if( !empty( $post_id ) ) {
  1683.             $output  = "";
  1684.             if ( is_sticky( get_the_ID() ) ) {
  1685.                 $output .= '<div class="post-list-styles post-list-style-1 sticky-post">';
  1686.             } else {
  1687.                 $output .= '<div class="post-list-styles post-list-style-1">';
  1688.             }
  1689.                 if( $image == 'true' ) {
  1690.                         if ( has_post_thumbnail( $post_id ) ) {
  1691.                             $image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'esport-big-post' );
  1692.                         } else {
  1693.                             $image_url = "";
  1694.                         }
  1695.  
  1696.                         if( !empty( $image_url ) ) {
  1697.                             $output .= '<div class="image">';
  1698.                                 $output .= '<a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '"><img src="' . esc_url( $image_url[0] ) . '" alt="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '" /></a>';
  1699.                                 if( $category == 'true' ) {
  1700.                                     $output .= '<div class="category">';
  1701.                                         $output .= get_the_category_list( '', '', $post_id );
  1702.                                     $output .= '</div>';
  1703.                                 }
  1704.                             $output .= '</div>';
  1705.                         }
  1706.                 }
  1707.  
  1708.                 $output .= '<div class="title"><a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '">' . get_the_title( $post_id ) . '</a></div>';
  1709.  
  1710.                 if( $excerpt == 'true' ) {
  1711.                     if( !empty( get_the_excerpt() ) ) {
  1712.                         $output .= '<div class="excerpt">' . get_the_excerpt() . '</div>';
  1713.                     }
  1714.                 }
  1715.  
  1716.                 if( $read_more == 'true' or $post_info == 'true' ) {
  1717.                     $output .= '<div class="bottom">';
  1718.                         if( $read_more == 'true' ) {
  1719.                             $output .= '<a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '" class="more-button">' . esc_html__( 'More', 'esport' ) . '</a>';
  1720.                         }
  1721.  
  1722.                         if( $post_info == 'true' ) {
  1723.                             $output .= '<ul class="post-information">';
  1724.                                 $output .= '<li class="date"><i class="fa fa-calendar" aria-hidden="true"></i>' . get_the_time( get_option( 'date_format' ), $post_id ) . '</li>';
  1725.                                 $output .= '<li class="comment"><i class="fa fa-comment" aria-hidden="true"></i>';
  1726.                                     $output .= '<a href="' . get_the_permalink( $post_id ) . '#comments" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '">';
  1727.                                         $num_comments = get_comments_number( $post_id );
  1728.                                         if ( $num_comments == 0 ) {
  1729.                                             $comments = esc_html__( '0 Comment', 'esport' );
  1730.                                         } elseif ( $num_comments > 1 ) {
  1731.                                             $comments = $num_comments . ' ' . esc_html__( 'Comments', 'esport' );
  1732.                                         } else {
  1733.                                             $comments = esc_html__( '1 Comment', 'esport' );
  1734.                                         }
  1735.                                         $output .= $comments;
  1736.                                     $output .= '</a>';
  1737.                                 $output .= '</li>';
  1738.                             $output .= '</ul>';
  1739.                         }
  1740.                     $output .= '</div>';
  1741.                 }
  1742.             $output .= '</div>';
  1743.             return $output;
  1744.         }
  1745.     }
  1746.     /*------------- POST LIST STYLE 1 END -------------*/
  1747.  
  1748.     /*------------- POST LIST STYLE 2 START -------------*/
  1749.     function esport_post_list_style_2( $post_id = "", $image = "", $category = "", $excerpt = "", $read_more = "", $post_info = "" ) {
  1750.         if( !empty( $post_id ) ) {
  1751.             $output  = "";
  1752.             if ( is_sticky( get_the_ID() ) ) {
  1753.                 $output .= '<div class="post-list-styles post-list-style-2 sticky-post">';
  1754.             } else {
  1755.                 $output .= '<div class="post-list-styles post-list-style-2">';
  1756.             }
  1757.                 if( $image == 'true' ) {
  1758.                         if ( has_post_thumbnail( $post_id ) ) {
  1759.                             $image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'esport-small-post' );
  1760.                         } else {
  1761.                             $image_url = "";
  1762.                         }
  1763.  
  1764.                         if( !empty( $image_url ) ) {
  1765.                             $output .= '<div class="image">';
  1766.                                 $output .= '<a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '"><img src="' . esc_url( $image_url[0] ) . '" alt="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '" /></a>';
  1767.                                 if( $category == 'true' ) {
  1768.                                     $output .= '<div class="category">';
  1769.                                         $output .= get_the_category_list( '', '', $post_id );
  1770.                                     $output .= '</div>';
  1771.                                 }
  1772.                             $output .= '</div>';
  1773.                         }
  1774.                 }
  1775.  
  1776.                 $output .= '<div class="title"><a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '">' . get_the_title( $post_id ) . '</a></div>';
  1777.  
  1778.                 if( $excerpt == 'true' ) {
  1779.                     if( !empty( get_the_excerpt() ) ) {
  1780.                         $output .= '<div class="excerpt">' . get_the_excerpt() . '</div>';
  1781.                     }
  1782.                 }
  1783.  
  1784.                 if( $read_more == 'true' or $post_info == 'true' ) {
  1785.                     $output .= '<div class="bottom">';
  1786.                         if( $read_more == 'true' ) {
  1787.                             $output .= '<a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '" class="more-button">' . esc_html__( 'More', 'esport' ) . '</a>';
  1788.                         }
  1789.  
  1790.                         if( $post_info == 'true' ) {
  1791.                             $output .= '<ul class="post-information">';
  1792.                                 $output .= '<li class="date"><i class="fa fa-calendar" aria-hidden="true"></i>' . get_the_time( get_option( 'date_format' ), $post_id ) . '</li>';
  1793.                                 $output .= '<li class="comment"><i class="fa fa-comment" aria-hidden="true"></i>';
  1794.                                     $output .= '<a href="' . get_the_permalink( $post_id ) . '#comments" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '">';
  1795.                                         $num_comments = get_comments_number( $post_id );
  1796.                                         if ( $num_comments == 0 ) {
  1797.                                             $comments = esc_html__( '0 Comment', 'esport' );
  1798.                                         } elseif ( $num_comments > 1 ) {
  1799.                                             $comments = $num_comments . ' ' . esc_html__( 'Comments', 'esport' );
  1800.                                         } else {
  1801.                                             $comments = esc_html__( '1 Comment', 'esport' );
  1802.                                         }
  1803.                                         $output .= $comments;
  1804.                                     $output .= '</a>';
  1805.                                 $output .= '</li>';
  1806.                             $output .= '</ul>';
  1807.                         }
  1808.                     $output .= '</div>';
  1809.                 }
  1810.             $output .= '</div>';
  1811.             return $output;
  1812.         }
  1813.     }
  1814.     /*------------- POST LIST STYLE 2 END -------------*/
  1815.  
  1816.     /*------------- POST LIST STYLE 3 START -------------*/
  1817.     function esport_post_list_style_3( $post_id = "", $image = "", $post_info = "" ) {
  1818.         if( !empty( $post_id ) ) {
  1819.             $output  = "";
  1820.             $output .= '<div class="post-list-styles post-list-style-3">';
  1821.                 if( $image == 'true' ) {
  1822.                     if ( has_post_thumbnail( $post_id ) ) {
  1823.                         $image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'thumbnail' );
  1824.  
  1825.                         if( !empty( $image_url ) ) {
  1826.                             $output .= '<div class="image">';
  1827.                                 $output .= '<a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '"><img src="' . esc_url( $image_url[0] ) . '" alt="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '" /></a>';
  1828.                             $output .= '</div>';
  1829.                         }
  1830.                     } else {
  1831.                         $image_url = "";
  1832.                     }
  1833.                 }
  1834.  
  1835.                 $output .= '<div class="desc">';
  1836.                     $output .= '<div class="title"><a href="' . get_the_permalink( $post_id ) . '" title="' . the_title_attribute( array( 'echo' => 0, 'post' => $post_id ) ) . '">' . get_the_title( $post_id ) . '</a></div>';
  1837.  
  1838.                     if( $post_info == 'true' ) {
  1839.                         $output .= '<div class="post-information"><i class="fa fa-calendar" aria-hidden="true"></i>' . get_the_time( get_option( 'date_format' ), $post_id ) . '</div>';
  1840.                     }
  1841.                 $output .= '</div>';
  1842.             $output .= '</div>';
  1843.             return $output;
  1844.         }
  1845.     }
  1846.     /*------------- POST LIST STYLE 3 END -------------*/
  1847.  
  1848.     /*------------- ARCHIVE POST LIST STYLES START -------------*/
  1849.     function esport_archive_post_list_styles() {
  1850.         function esport_archive_post_list_styles_style1() {
  1851.             echo '<div class="archive-post-list-style-1 post-list">';
  1852.                 while ( have_posts() ) : the_post();
  1853.                     echo esport_post_list_style_1( $post_id = get_the_ID(), $image = "true", $category = "true", $excerpt = "true", $read_more = "true", $post_info = "true" );
  1854.                 endwhile;
  1855.             echo '</div>';
  1856.         }
  1857.        
  1858.         function esport_archive_post_list_styles_style2() {
  1859.             echo '<div class="archive-post-list-style-5 post-list">';
  1860.                 while ( have_posts() ) : the_post();
  1861.                     echo esport_post_list_style_2( $post_id = get_the_ID(), $image = "true", $category = "true", $excerpt = "true", $read_more = "true", $post_info = "true" );
  1862.                 endwhile;
  1863.             echo '</div>';
  1864.         }
  1865.  
  1866.         if( is_category() ) {
  1867.             $archive_archive_post_list_style = ot_get_option( 'blog_category_post_list_style' );
  1868.         } elseif( is_tag() ) {
  1869.             $archive_archive_post_list_style = ot_get_option( 'tag_tag_post_list_style' );
  1870.         } elseif( is_search() ) {
  1871.             $archive_archive_post_list_style = ot_get_option( 'search_search_post_list_style' );
  1872.         } else {
  1873.             $archive_archive_post_list_style = ot_get_option( 'archive_archive_post_list_style' );
  1874.         }
  1875.        
  1876.         if( is_category() ) {
  1877.             $cat = get_queried_object();
  1878.             $cat_id = $cat->term_id;
  1879.             $esport_category_category_post_list_style = get_term_meta( $cat_id, 'esport_category_category_post_list_style', true );
  1880.             if( $esport_category_category_post_list_style == "post-list-style-1" ) {
  1881.                 esport_archive_post_list_styles_style1();              
  1882.             } elseif( $esport_category_category_post_list_style == "post-list-style-2" ) {
  1883.                 esport_archive_post_list_styles_style2();              
  1884.             } else {
  1885.                 if( $archive_archive_post_list_style == "style2" ) {
  1886.                     esport_archive_post_list_styles_style2();
  1887.                 } else {
  1888.                     esport_archive_post_list_styles_style1();
  1889.                 }
  1890.             }
  1891.  
  1892.         } else {
  1893.             if( $archive_archive_post_list_style == "style2" ) {
  1894.                 esport_archive_post_list_styles_style2();
  1895.             } else {
  1896.                 esport_archive_post_list_styles_style1();
  1897.             }
  1898.         }
  1899.     }
  1900.     /*------------- ARCHIVE POST LIST STYLES END -------------*/
  1901. /*------------- POST LIST STYLES END -------------*/
  1902.  
  1903. /*------------- TITLES START -------------*/
  1904.     /*------------- ARCHIVE TITLES START -------------*/
  1905.     function esport_archive_title() {
  1906.         echo '<div class="page-title-breadcrumbs">';
  1907.             echo '<div class="page-title-breadcrumbs-image"></div>';
  1908.             echo '<div class="container">';
  1909.                 echo '<h1>';
  1910.                     if( is_category() ) {
  1911.                         $blog_category_title = ot_get_option( 'blog_category_title' );
  1912.                         if( !$blog_category_title == 'off' or $blog_category_title == 'on' ) {
  1913.                             $allowed_html = array ( 'span' => array() ); wp_kses( printf( __( '<span>%s</span>', 'esport' ), single_cat_title( '', false ) ) , $allowed_html );
  1914.                         }
  1915.                     } elseif( is_tag() ) {
  1916.                         $tag_tag_title = ot_get_option( 'tag_tag_title' );
  1917.                         if( !$tag_tag_title == 'off' or $tag_tag_title == 'on' ) {
  1918.                             $allowed_html = array ( 'span' => array() ); wp_kses( printf( __( '<span>%s</span>', 'esport' ), single_tag_title( '', false ) ) , $allowed_html );
  1919.                         }
  1920.                     } elseif( is_search() ) {
  1921.                         $search_search_title = ot_get_option( 'search_search_title' );
  1922.                         if( !$search_search_title == 'off' or $search_search_title == 'on' ) {
  1923.                             $allowed_html = array ( 'span' => array() ); wp_kses ( printf( __( '<span>%s</span>', 'esport' ), get_search_query() ) , $allowed_html );
  1924.                         }
  1925.                     } elseif( is_author() ) {
  1926.                         printf( esc_html__( '%s', 'esport' ), '' . get_the_author() . '' );
  1927.                     } elseif( is_home() ) {
  1928.                         echo esc_html__( 'Home', 'esport' );
  1929.                     } elseif( is_attachment() ) {
  1930.                         $attachment_attachment_title = ot_get_option( 'attachment_attachment_title' );
  1931.                         if( !$attachment_attachment_title == 'off' or $attachment_attachment_title == 'on' ) {
  1932.                             echo get_the_title();
  1933.                         }
  1934.                     } elseif( is_page() ) {
  1935.                         $page_title = ot_get_option( 'page_title' );
  1936.                         if( !$page_title == 'off' or $page_title == 'on' ) {
  1937.                             echo get_the_title();
  1938.                         }
  1939.                     } elseif( is_single() ) {
  1940.                         $post_post_title = ot_get_option( 'post_post_title' );
  1941.                         if( !$post_post_title == 'off' or $post_post_title == 'on' ) {
  1942.                             echo get_the_title();
  1943.                         }
  1944.                     } elseif( is_bbpress() ) {
  1945.                         $archive_esport_archive_title = ot_get_option( 'archive_esport_archive_title' );
  1946.                         if( !$archive_esport_archive_title == 'off' or $archive_esport_archive_title == 'on' ) {
  1947.                             echo esc_html__( 'Forums', 'esport' );
  1948.                         }
  1949.                     } else {
  1950.                         $archive_esport_archive_title = ot_get_option( 'archive_esport_archive_title' );
  1951.                         if( !$archive_esport_archive_title == 'off' or $archive_esport_archive_title == 'on' ) {
  1952.                             if ( is_day() ) :
  1953.                                 printf( esc_html__( 'Daily Archives: %s', 'esport' ), get_the_date() );
  1954.                             elseif ( is_month() ) :
  1955.                                 printf( esc_html__( 'Monthly Archives: %s', 'esport' ), get_the_date( _x( 'F Y', 'Monthly archives date format', 'esport' ) ) );
  1956.                             elseif ( is_year() ) :
  1957.                                 printf( esc_html__( 'Yearly Archives: %s', 'esport' ), get_the_date( _x( 'Y', 'Yearly archives date format', 'esport' ) ) );
  1958.                             else :
  1959.                                 echo esc_html__( 'Archives', 'esport' );
  1960.                             endif;
  1961.                         }
  1962.                     }
  1963.                 echo '</h1>';
  1964.             echo '</div>';
  1965.         echo '</div>';
  1966.     }
  1967.  
  1968.     function esport_archive_title_none() {
  1969.         echo '<div class="archive-title-none"></div>';
  1970.     }
  1971.     /*------------- ARCHIVE TITLES END -------------*/
  1972.  
  1973.     /*------------- CONTENT TITLES START -------------*/
  1974.     function esport_content_title_start( $text = "" ) {
  1975.         echo '<div class="content-title-wrapper">';
  1976.             echo '<div class="title">' . $text . '</div>';
  1977.         echo '</div>';
  1978.     }
  1979.  
  1980.     function esport_content_alternative_title_start( $text = "" ) {
  1981.         echo '<span class="content-alternative-wrapper-title">' . $text . '</span>';
  1982.     }
  1983.     /*------------- CONTENT TITLES END -------------*/
  1984. /*------------- TITLES END -------------*/
  1985.  
  1986. /*------------- SIDEBARS & COLUMNS START -------------*/
  1987.     /*------------- CREATE SIDEBARS START -------------*/
  1988.     if( !function_exists( 'esport_sidebars_init' ) ) {
  1989.         function esport_sidebars_init() {
  1990.             register_sidebar(array(
  1991.                 'id' => 'general-sidebar',
  1992.                 'name' => esc_html__( 'General Sidebar', 'esport' ),
  1993.                 'before_widget' => '<div id="%1$s" class="general-sidebar-wrap widget-box %2$s">',
  1994.                 'after_widget' => '</div>',
  1995.                 'before_title' => '<div class="widget-title">',
  1996.                 'after_title' => '</div>',
  1997.             ));
  1998.            
  1999.             register_sidebar(array(
  2000.                 'id' => 'shop-sidebar',
  2001.                 'name' => esc_html__( 'Shop Sidebar', 'esport' ),
  2002.                 'before_widget' => '<div id="%1$s" class="shop-sidebar-wrap widget-box %2$s">',
  2003.                 'after_widget' => '</div>',
  2004.                 'before_title' => '<div class="widget-title">',
  2005.                 'after_title' => '</div>',
  2006.             ));
  2007.         }
  2008.     }
  2009.  
  2010.     add_action( 'widgets_init', 'esport_sidebars_init' );
  2011.     /*------------- CREATE SIDEBARS END -------------*/
  2012.  
  2013.     /*------------- SIDEBAR START -------------*/
  2014.     function esport_post_content_area_start() {
  2015.         if(class_exists('Woocommerce') ) {
  2016.             if( is_shop() ) {
  2017.                 $sidebar_position = ot_get_option('woocommerce_sidebar_position');
  2018.             } elseif( is_product() ) {
  2019.                 $sidebar_position = ot_get_option('woocommerce_product_sidebar_position');
  2020.  
  2021.             } elseif( is_category() ) {
  2022.                 $cat = get_queried_object();
  2023.                 $cat_id = $cat->term_id;
  2024.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2025.                 if( !empty( $esport_category_sidebar_style ) ) {
  2026.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2027.                 } else {
  2028.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2029.                 }
  2030.             } elseif( is_tag() ) {
  2031.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2032.             } elseif( is_author() ) {
  2033.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2034.             } elseif( is_search() ) {
  2035.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2036.             } elseif( is_archive() ) {
  2037.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2038.             } elseif( is_attachment() ) {
  2039.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2040.             } elseif( is_single() ) {
  2041.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2042.             } elseif( is_page() ) {
  2043.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2044.             } else {
  2045.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2046.             }
  2047.  
  2048.             if ( is_page() or is_single() ) {
  2049.                 global $post;
  2050.                 $layout_select = get_post_meta( $post->ID, 'sidebar_position', true);
  2051.             } else {
  2052.                 $layout_select = "";
  2053.             }
  2054.            
  2055.             if( $layout_select == 'nosidebar' ) {
  2056.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 fullwidthsidebar">';
  2057.             }
  2058.            
  2059.             elseif( $layout_select == 'left' ) {
  2060.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-right left pull-right fixedSidebar">';
  2061.             }
  2062.            
  2063.             elseif( $layout_select == 'right' ) {
  2064.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left right fixedSidebar">';
  2065.             }
  2066.            
  2067.             elseif( $sidebar_position == 'nosidebar' ) {
  2068.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 fullwidthsidebar">';
  2069.             }
  2070.            
  2071.             elseif( $sidebar_position == 'left' ) {
  2072.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-right left pull-right fixedSidebar">';
  2073.             }
  2074.            
  2075.             elseif( $sidebar_position == 'right' ) {
  2076.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left right fixedSidebar">';
  2077.             }
  2078.            
  2079.             else {
  2080.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left right fixedSidebar">';
  2081.             }
  2082.         } else {
  2083.             if( is_category() ) {
  2084.                 $cat = get_queried_object();
  2085.                 $cat_id = $cat->term_id;
  2086.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2087.                 if( !empty( $esport_category_sidebar_style ) ) {
  2088.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2089.                 } else {
  2090.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2091.                 }
  2092.             } elseif( is_tag() ) {
  2093.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2094.             } elseif( is_author() ) {
  2095.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2096.             } elseif( is_search() ) {
  2097.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2098.             } elseif( is_archive() ) {
  2099.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2100.             } elseif( is_attachment() ) {
  2101.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2102.             } elseif( is_single() ) {
  2103.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2104.             } elseif( is_page() ) {
  2105.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2106.             } else {
  2107.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2108.             }
  2109.  
  2110.             if ( is_page() or is_single() ) {
  2111.                 global $post;
  2112.                 $layout_select = get_post_meta( $post->ID, 'sidebar_position', true);
  2113.             } else {
  2114.                 $layout_select = "";
  2115.             }
  2116.            
  2117.             if( $layout_select == 'nosidebar' ) {
  2118.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 fullwidthsidebar">';
  2119.             }
  2120.            
  2121.             elseif( $layout_select == 'left' ) {
  2122.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-right left pull-right fixedSidebar">';
  2123.             }
  2124.            
  2125.             elseif( $layout_select == 'right' ) {
  2126.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left right fixedSidebar">';
  2127.             }
  2128.            
  2129.             elseif( $sidebar_position == 'nosidebar' ) {
  2130.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 fullwidthsidebar">';
  2131.             }
  2132.            
  2133.             elseif( $sidebar_position == 'left' ) {
  2134.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-right left pull-right fixedSidebar">';
  2135.             }
  2136.            
  2137.             elseif( $sidebar_position == 'right' ) {
  2138.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left right fixedSidebar">';
  2139.             }
  2140.            
  2141.             else {
  2142.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left right fixedSidebar">';
  2143.             }
  2144.         }
  2145.     }
  2146.  
  2147.     function esport_post_sidebar_start() {
  2148.         if(class_exists('Woocommerce') ) {
  2149.             if( is_shop() ) {
  2150.                 $sidebar_position = ot_get_option('woocommerce_sidebar_position');
  2151.             } elseif( is_product() ) {
  2152.                 $sidebar_position = ot_get_option('woocommerce_product_sidebar_position');
  2153.             } elseif( is_category() ) {
  2154.                 $cat = get_queried_object();
  2155.                 $cat_id = $cat->term_id;
  2156.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2157.                 if( !empty( $esport_category_sidebar_style ) ) {
  2158.                     $cat = get_queried_object();
  2159.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2160.                 } else {
  2161.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2162.                 }
  2163.             } elseif( is_tag() ) {
  2164.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2165.             } elseif( is_author() ) {
  2166.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2167.             } elseif( is_search() ) {
  2168.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2169.             } elseif( is_archive() ) {
  2170.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2171.             } elseif( is_attachment() ) {
  2172.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2173.             } elseif( is_single() ) {
  2174.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2175.             } elseif( is_page() ) {
  2176.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2177.             } else {
  2178.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2179.             }
  2180.  
  2181.             if ( is_page() or is_single() ) {          
  2182.                 global $post;
  2183.                 $layout_select = get_post_meta( $post->ID, 'sidebar_position', true);
  2184.             } else {
  2185.                 $layout_select = "";
  2186.             }
  2187.            
  2188.             if( $layout_select == 'nosidebar' ) {
  2189.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hide fixedSidebar"><div class="theiaStickySidebar">';
  2190.             }
  2191.            
  2192.             elseif( $layout_select == 'left' ) {
  2193.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right left fixedSidebar"><div class="theiaStickySidebar">';
  2194.             }
  2195.            
  2196.             elseif( $layout_select == 'right' ) {
  2197.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right right fixedSidebar"><div class="theiaStickySidebar">';
  2198.             }
  2199.            
  2200.             elseif( $sidebar_position == 'nosidebar' ) {
  2201.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hide fixedSidebar"><div class="theiaStickySidebar">';
  2202.             }
  2203.            
  2204.             elseif( $sidebar_position == 'left' ) {
  2205.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right left fixedSidebar"><div class="theiaStickySidebar">';
  2206.             }
  2207.            
  2208.             elseif( $sidebar_position == 'right' ) {
  2209.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right right fixedSidebar"><div class="theiaStickySidebar">';
  2210.             }
  2211.            
  2212.             else {
  2213.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right fixedSidebar"><div class="theiaStickySidebar">';
  2214.             }
  2215.         } else {
  2216.             if( is_category() ) {
  2217.                 $cat = get_queried_object();
  2218.                 $cat_id = $cat->term_id;
  2219.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2220.                 if( !empty( $esport_category_sidebar_style ) ) {
  2221.                     $cat = get_queried_object();
  2222.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2223.                 } else {
  2224.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2225.                 }
  2226.             } elseif( is_tag() ) {
  2227.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2228.             } elseif( is_author() ) {
  2229.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2230.             } elseif( is_search() ) {
  2231.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2232.             } elseif( is_archive() ) {
  2233.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2234.             } elseif( is_attachment() ) {
  2235.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2236.             } elseif( is_single() ) {
  2237.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2238.             } elseif( is_page() ) {
  2239.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2240.             } else {
  2241.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2242.             }
  2243.  
  2244.             if ( is_page() or is_single() ) {          
  2245.                 global $post;
  2246.                 $layout_select = get_post_meta( $post->ID, 'sidebar_position', true);
  2247.             } else {
  2248.                 $layout_select = "";
  2249.             }
  2250.            
  2251.             if( $layout_select == 'nosidebar' ) {
  2252.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hide fixedSidebar"><div class="theiaStickySidebar">';
  2253.             }
  2254.            
  2255.             elseif( $layout_select == 'left' ) {
  2256.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right left fixedSidebar"><div class="theiaStickySidebar">';
  2257.             }
  2258.            
  2259.             elseif( $layout_select == 'right' ) {
  2260.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right right fixedSidebar"><div class="theiaStickySidebar">';
  2261.             }
  2262.            
  2263.             elseif( $sidebar_position == 'nosidebar' ) {
  2264.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hide fixedSidebar"><div class="theiaStickySidebar">';
  2265.             }
  2266.            
  2267.             elseif( $sidebar_position == 'left' ) {
  2268.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right left fixedSidebar"><div class="theiaStickySidebar">';
  2269.             }
  2270.            
  2271.             elseif( $sidebar_position == 'right' ) {
  2272.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right right fixedSidebar"><div class="theiaStickySidebar">';
  2273.             }
  2274.            
  2275.             else {
  2276.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right fixedSidebar"><div class="theiaStickySidebar">';
  2277.             }
  2278.         }
  2279.     }
  2280.  
  2281.     function esport_content_area_start() {
  2282.         if(class_exists('Woocommerce') ) {
  2283.             if( is_shop() ) {
  2284.                 $sidebar_position = ot_get_option('woocommerce_sidebar_position');
  2285.             } elseif( is_product() ) {
  2286.                 $sidebar_position = ot_get_option('woocommerce_product_sidebar_position');
  2287.             } elseif( is_category() ) {
  2288.                 $cat = get_queried_object();
  2289.                 $cat_id = $cat->term_id;
  2290.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2291.                 if( !empty( $esport_category_sidebar_style ) ) {
  2292.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2293.                 } else {
  2294.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2295.                 }
  2296.             } elseif( is_tag() ) {
  2297.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2298.             } elseif( is_author() ) {
  2299.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2300.             } elseif( is_search() ) {
  2301.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2302.             } elseif( is_archive() ) {
  2303.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2304.             } elseif( is_attachment() ) {
  2305.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2306.             } elseif( is_single() ) {
  2307.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2308.             } elseif( is_page() ) {
  2309.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2310.             } else {
  2311.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2312.             }
  2313.            
  2314.             if( $sidebar_position == 'nosidebar' ) {
  2315.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 fullwidthsidebar">';
  2316.             }
  2317.            
  2318.             elseif( $sidebar_position == 'left' ) {
  2319.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-right site-content-left pull-right fixedSidebar">';
  2320.             }
  2321.            
  2322.             elseif( $sidebar_position == 'right' ) {
  2323.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left fixedSidebar">';
  2324.             }
  2325.            
  2326.             else {
  2327.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left fixedSidebar">';
  2328.             }
  2329.         } else {
  2330.             if( is_category() ) {
  2331.                 $cat = get_queried_object();
  2332.                 $cat_id = $cat->term_id;
  2333.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2334.                 if( !empty( $esport_category_sidebar_style ) ) {
  2335.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2336.                 } else {
  2337.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2338.                 }
  2339.             } elseif( is_tag() ) {
  2340.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2341.             } elseif( is_author() ) {
  2342.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2343.             } elseif( is_search() ) {
  2344.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2345.             } elseif( is_archive() ) {
  2346.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2347.             } elseif( is_attachment() ) {
  2348.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2349.             } elseif( is_single() ) {
  2350.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2351.             } elseif( is_page() ) {
  2352.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2353.             } else {
  2354.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2355.             }
  2356.            
  2357.             if( $sidebar_position == 'nosidebar' ) {
  2358.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 fullwidthsidebar">';
  2359.             }
  2360.            
  2361.             elseif( $sidebar_position == 'left' ) {
  2362.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-right site-content-left pull-right fixedSidebar">';
  2363.             }
  2364.            
  2365.             elseif( $sidebar_position == 'right' ) {
  2366.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left fixedSidebar">';
  2367.             }
  2368.            
  2369.             else {
  2370.                 echo '<div class="col-lg-9 col-md-8 col-sm-12 col-xs-12 site-content-left fixedSidebar">';
  2371.             }
  2372.         }
  2373.     }
  2374.  
  2375.     function esport_sidebar_start() {
  2376.         if(class_exists('Woocommerce') ) {
  2377.             if( is_shop() ) {
  2378.                 $sidebar_position = ot_get_option('woocommerce_sidebar_position');
  2379.             } elseif( is_product() ) {
  2380.                 $sidebar_position = ot_get_option('woocommerce_product_sidebar_position');
  2381.             } elseif( is_category() ) {
  2382.                 $cat = get_queried_object();
  2383.                 $cat_id = $cat->term_id;
  2384.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2385.                 if( !empty( $esport_category_sidebar_style ) ) {
  2386.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2387.                 } else {
  2388.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2389.                 }
  2390.             } elseif( is_tag() ) {
  2391.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2392.             } elseif( is_author() ) {
  2393.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2394.             } elseif( is_search() ) {
  2395.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2396.             } elseif( is_archive() ) {
  2397.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2398.             } elseif( is_attachment() ) {
  2399.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2400.             } elseif( is_single() ) {
  2401.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2402.             } elseif( is_page() ) {
  2403.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2404.             } else {
  2405.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2406.             }
  2407.            
  2408.             if( $sidebar_position == 'nosidebar' ) {
  2409.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hide fixedSidebar"><div class="theiaStickySidebar">';
  2410.             }
  2411.            
  2412.             elseif( $sidebar_position == 'left' ) {
  2413.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right left fixedSidebar"><div class="theiaStickySidebar">';
  2414.             }
  2415.            
  2416.             elseif( $sidebar_position == 'right' ) {
  2417.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right right fixedSidebar"><div class="theiaStickySidebar">';
  2418.             }
  2419.            
  2420.             else {
  2421.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right fixedSidebar"><div class="theiaStickySidebar">';
  2422.             }
  2423.         } else {
  2424.             if( is_category() ) {
  2425.                 $cat = get_queried_object();
  2426.                 $cat_id = $cat->term_id;
  2427.                 $esport_category_sidebar_style = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2428.                 if( !empty( $esport_category_sidebar_style ) ) {
  2429.                     $sidebar_position = get_term_meta( $cat_id, 'esport_category_sidebar_style', true );
  2430.                 } else {
  2431.                     $sidebar_position = ot_get_option('category_sidebar_position');
  2432.                 }
  2433.             } elseif( is_tag() ) {
  2434.                 $sidebar_position = ot_get_option('tag_sidebar_position');
  2435.             } elseif( is_author() ) {
  2436.                 $sidebar_position = ot_get_option('author_sidebar_position');
  2437.             } elseif( is_search() ) {
  2438.                 $sidebar_position = ot_get_option('search_sidebar_position');
  2439.             } elseif( is_archive() ) {
  2440.                 $sidebar_position = ot_get_option('archive_sidebar_position');
  2441.             } elseif( is_attachment() ) {
  2442.                 $sidebar_position = ot_get_option('attachment_sidebar_position');
  2443.             } elseif( is_single() ) {
  2444.                 $sidebar_position = ot_get_option('post_sidebar_position');
  2445.             } elseif( is_page() ) {
  2446.                 $sidebar_position = ot_get_option('page_sidebar_position');
  2447.             } else {
  2448.                 $sidebar_position = ot_get_option( 'sidebar_position' );
  2449.             }
  2450.            
  2451.             if( $sidebar_position == 'nosidebar' ) {
  2452.                 echo '<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 hide fixedSidebar"><div class="theiaStickySidebar">';
  2453.             }
  2454.            
  2455.             elseif( $sidebar_position == 'left' ) {
  2456.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right left fixedSidebar"><div class="theiaStickySidebar">';
  2457.             }
  2458.            
  2459.             elseif( $sidebar_position == 'right' ) {
  2460.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right right fixedSidebar"><div class="theiaStickySidebar">';
  2461.             }
  2462.            
  2463.             else {
  2464.                 echo '<div class="col-lg-3 col-md-4 col-sm-12 col-xs-12 site-content-right fixedSidebar"><div class="theiaStickySidebar">';
  2465.             }
  2466.         }
  2467.     }
  2468.  
  2469.     function esport_content_area_end() {
  2470.         echo '</div>';
  2471.     }
  2472.  
  2473.     function esport_sidebar_end() {
  2474.         echo '</div></div>';
  2475.     }
  2476.     /*------------- SIDEBAR END -------------*/
  2477.  
  2478.     /*------------- WRAPPER BEFORE START -------------*/
  2479.     function esport_wrapper_before() {
  2480.         ?>
  2481.             <div class="esport-wrapper" id="general-wrapper">
  2482.         <?php
  2483.     }
  2484.     /*------------- WRAPPER BEFORE END -------------*/
  2485.  
  2486.     /*------------- WRAPPER AFTER START -------------*/
  2487.     function esport_wrapper_after() {
  2488.         ?>
  2489.             </div>
  2490.         <?php
  2491.     }
  2492.     /*------------- WRAPPER AFTER END -------------*/
  2493.  
  2494.     /*------------- SITE CONTENT START -------------*/
  2495.     function esport_site_content_start() {
  2496.         ?>
  2497.             <div class="site-content">
  2498.         <?php
  2499.     }
  2500.  
  2501.     function esport_site_content_end() {
  2502.         ?>         
  2503.             </div>
  2504.         <?php
  2505.     }
  2506.     /*------------- SITE CONTENT END -------------*/
  2507.  
  2508.     /*------------- SITE SUB CONTENT START -------------*/
  2509.     function esport_site_sub_content_start() {
  2510.         ?>
  2511.             <div class="site-sub-content">
  2512.         <?php
  2513.     }
  2514.  
  2515.     function esport_site_sub_content_end() {
  2516.         ?>         
  2517.             </div>
  2518.         <?php
  2519.     }
  2520.     /*------------- SITE SUB CONTENT END -------------*/
  2521.  
  2522.     /*------------- WIDGET CONTENT BEFORE START -------------*/
  2523.     function esport_widget_content_before() {
  2524.         ?>
  2525.             <div class="widget-content">
  2526.         <?php
  2527.     }
  2528.     /*------------- WIDGET CONTENT BEFORE END -------------*/
  2529.  
  2530.     /*------------- WIDGET CONTENT AFTER START -------------*/
  2531.     function esport_widget_content_after() {
  2532.         ?>
  2533.             </div>
  2534.         <?php
  2535.     }
  2536.     /*------------- WIDGET CONTENT AFTER END -------------*/
  2537.  
  2538.     /*------------- SITE PAGE CONTENT BEFORE START -------------*/
  2539.     function esport_site_page_content_before() {
  2540.         ?>
  2541.             <div class="site-page-content">
  2542.         <?php
  2543.     }
  2544.     /*------------- SITE PAGE CONTENT BEFORE END -------------*/
  2545.  
  2546.     /*------------- SITE PAGE CONTENT AFTER START -------------*/
  2547.     function esport_site_page_content_after() {
  2548.         ?>
  2549.             </div>
  2550.         <?php
  2551.     }
  2552.     /*------------- SITE PAGE CONTENT AFTER END -------------*/
  2553.  
  2554.     /*------------- CONTAINER BEFORE START -------------*/
  2555.     function esport_container_before() {
  2556.         ?>
  2557.             <div class="container">
  2558.         <?php
  2559.     }
  2560.     /*------------- CONTAINER BEFORE END -------------*/
  2561.  
  2562.     /*------------- CONTAINER AFTER START -------------*/
  2563.     function esport_container_after() {
  2564.         ?>
  2565.             </div>
  2566.         <?php
  2567.     }
  2568.     /*------------- CONTAINER AFTER END -------------*/
  2569.  
  2570.     /*------------- ROW BEFORE START -------------*/
  2571.     function esport_row_before() {
  2572.         ?>
  2573.             <div class="row">
  2574.         <?php
  2575.     }
  2576.     /*------------- ROW BEFORE END -------------*/
  2577.  
  2578.     /*------------- ROW AFTER START -------------*/
  2579.     function esport_row_after() {
  2580.         ?>
  2581.             </div>
  2582.         <?php
  2583.     }
  2584.     /*------------- ROW AFTER END -------------*/
  2585. /*------------- SIDEBARS & COLUMNS END -------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement