Guest User

Untitled

a guest
Jan 7th, 2020
53
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * consultstreet functions and definitions
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6. *
  7. * @package consultstreet
  8. */
  9.  
  10. if ( ! function_exists( 'consultstreet_setup' ) ) :
  11. /**
  12. * Sets up theme defaults and registers support for various WordPress features.
  13. *
  14. * Note that this function is hooked into the after_setup_theme hook, which
  15. * runs before the init hook. The init hook is too late for some features, such
  16. * as indicating support for post thumbnails.
  17. */
  18. function consultstreet_setup() {
  19. /*
  20. * Make theme available for translation.
  21. * Translations can be filed in the /languages/ directory.
  22. * If you're building a theme based on consultstreet, use a find and replace
  23. * to change 'consultstreet' to the name of your theme in all the template files.
  24. */
  25. load_theme_textdomain( 'consultstreet', get_template_directory() . '/languages' );
  26.  
  27. // Add default posts and comments RSS feed links to head.
  28. add_theme_support( 'automatic-feed-links' );
  29.  
  30. /*
  31. * Let WordPress manage the document title.
  32. * By adding theme support, we declare that this theme does not use a
  33. * hard-coded <title> tag in the document head, and expect WordPress to
  34. * provide it for us.
  35. */
  36. add_theme_support( 'title-tag' );
  37.  
  38. /*
  39. * Enable support for Post Thumbnails on posts and pages.
  40. *
  41. * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
  42. */
  43. add_theme_support( 'post-thumbnails' );
  44.  
  45. // This theme uses wp_nav_menu() in one location.
  46. // This theme uses wp_nav_menu() in one location.
  47. register_nav_menus( array(
  48. 'primary' => esc_html__( 'Primary', 'consultstreet' ),
  49. ) );
  50.  
  51. // Add theme support for selective refresh for widgets.
  52. add_theme_support( 'customize-selective-refresh-widgets' );
  53.  
  54. // woocommerce support
  55.  
  56. add_theme_support( 'woocommerce' );
  57.  
  58. // Woocommerce Gallery Support
  59. add_theme_support( 'wc-product-gallery-zoom' );
  60. add_theme_support( 'wc-product-gallery-lightbox' );
  61. add_theme_support( 'wc-product-gallery-slider' );
  62.  
  63. /**
  64. * Add support for core custom logo.
  65. *
  66. * @link https://codex.wordpress.org/Theme_Logo
  67. */
  68. add_theme_support( 'custom-logo', array(
  69. 'height' => 42,
  70. 'width' => 257,
  71. 'flex-height' => true,
  72. 'flex-width' => true,
  73. 'header-text' => array( 'site-title', 'site-description' ),
  74.  
  75. ) );
  76.  
  77. /**
  78. * Enable support for Post Formats.
  79. *
  80. * See: https://codex.wordpress.org/Post_Formats
  81. */
  82. add_theme_support( 'post-formats', array(
  83. 'aside',
  84. 'image',
  85. 'video',
  86. 'quote',
  87. 'link',
  88. 'gallery',
  89. 'status',
  90. 'audio',
  91. 'chat',
  92. ) );
  93.  
  94. /**
  95. * Custom background support.
  96. */
  97. add_theme_support( 'custom-background' );
  98. }
  99. endif;
  100. add_action( 'after_setup_theme', 'consultstreet_setup' );
  101.  
  102. /**
  103. * Register widget area.
  104. *
  105. * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
  106. */
  107.  
  108. function consultstreet_widgets_init() {
  109. $sidebars = apply_filters( 'consultstreet_sidebars_data', array(
  110. 'sidebar-main' => esc_html__( 'Sidebar', 'consultstreet' ),
  111. 'footer-sidebar-one' => esc_html__( 'Footer Sidebar One', 'consultstreet' ),
  112. 'footer-sidebar-two' => esc_html__( 'Footer Sidebar Two', 'consultstreet' ),
  113. 'footer-sidebar-three' => esc_html__( 'Footer Sidebar Three', 'consultstreet' ),
  114. 'footer-sidebar-four' => esc_html__( 'Footer Sidebar Four', 'consultstreet' ),
  115. ) );
  116.  
  117. if ( class_exists( 'WooCommerce' ) ) {
  118. $sidebars['woocommerce'] = esc_html__( 'WooCommerce Sidebar', 'consultstreet' );
  119. }
  120.  
  121. foreach ( $sidebars as $id => $name ) :
  122.  
  123. register_sidebar( array(
  124. 'id' => $id,
  125. 'name' => $name,
  126. 'description' => esc_html__( 'Add widgets here.', 'consultstreet' ),
  127. 'before_widget' => '<aside id="%1$s" class="widget text_widget %2$s">',
  128. 'after_widget' => '</aside>',
  129. 'before_title' => '<h4 class="widget-title">',
  130. 'after_title' => '</h4>',
  131. ) );
  132.  
  133. endforeach;
  134.  
  135. }
  136. add_action( 'widgets_init', 'consultstreet_widgets_init');
  137.  
  138. add_filter('woocommerce_show_page_title', '__return_false');
  139.  
  140. /**
  141. * Enqueue scripts and styles.
  142. */
  143. function consultstreet_scripts() {
  144. $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
  145. /**
  146. * Styles.
  147. */
  148.  
  149. wp_enqueue_style('bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css');
  150.  
  151. // Fontawesome.
  152. wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome/css/font-awesome' . $suffix . '.css', false, '4.7.0' );
  153. // Theme style.
  154. wp_enqueue_style( 'consultstreet-style', get_stylesheet_uri() );
  155.  
  156. if(get_theme_mod('consultstreet_theme_custom_color_disabled') == true) : consultstreet_custom_color_css();
  157. else:
  158. $css_file = get_theme_mod('consultstreet_theme_color','theme-default');
  159. wp_enqueue_style('theme-default', get_template_directory_uri() . '/assets/css/'.$css_file.'.css');
  160. endif;
  161.  
  162. wp_enqueue_style('consultstreet-animate-css', get_template_directory_uri() . '/assets/css/animate.css');
  163. wp_enqueue_style('owl.carousel-css', get_template_directory_uri() . '/assets/css/owl.carousel.css');
  164. wp_enqueue_style('bootstrap-smartmenus-css', get_template_directory_uri() . '/assets/css/bootstrap-smartmenus.css');
  165. wp_enqueue_style('consultstreet-lightbox-css', get_template_directory_uri() . '/assets/css/lightbox.css');
  166.  
  167.  
  168.  
  169. /**
  170. * Scripts.
  171. */
  172. wp_enqueue_script( 'jquery' );
  173. wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/assets/js/bootstrap.min.js');
  174.  
  175. // Theme JavaScript.
  176.  
  177. wp_enqueue_script('consultstreet-lightbox-js', get_template_directory_uri() . '/assets/js/lightbox/lightbox-2.6.min.js');
  178. wp_enqueue_script('consultstreet-smartmenus-js', get_template_directory_uri() . '/assets/js/smartmenus/jquery.smartmenus.js');
  179.  
  180. wp_enqueue_script('consultstreet-custom-js', get_template_directory_uri() . '/assets/js/custom.js');
  181. wp_enqueue_script('bootstrap-smartmenus-js', get_template_directory_uri() . '/assets/js/smartmenus/bootstrap-smartmenus.js');
  182. wp_enqueue_script('consultstreet-wow-js', get_template_directory_uri() . '/assets/js/wow.js');
  183. wp_enqueue_script('owl-carousel-js', get_template_directory_uri() . '/assets/js/owl.carousel.min.js');
  184.  
  185. wp_enqueue_script('mansory-js', get_template_directory_uri() . '/assets/js/masonry/mp.mansory.js');
  186.  
  187. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  188. wp_enqueue_script( 'comment-reply' );
  189. }
  190. }
  191. add_action( 'wp_enqueue_scripts', 'consultstreet_scripts' );
  192.  
  193. function consultstreet_customizer_script() {
  194. wp_enqueue_script( 'consultstreet-customizer-script', get_template_directory_uri() .'/inc/customizer/assets/js/customizer-section.js', array("jquery"),'', true );
  195. }
  196. add_action( 'customize_controls_enqueue_scripts', 'consultstreet_customizer_script' );
  197.  
  198.  
  199. /**
  200. * Define constants
  201. */
  202. // Root path/URI.
  203. define( 'CONSULTSTREET_PARENT_DIR', get_template_directory() );
  204. define( 'CONSULTSTREET_PARENT_URI', get_template_directory_uri() );
  205.  
  206. // Include path/URI.
  207. define( 'CONSULTSTREET_PARENT_INC_DIR', CONSULTSTREET_PARENT_DIR . '/inc' );
  208. define( 'CONSULTSTREET_PARENT_INC_URI', CONSULTSTREET_PARENT_URI . '/inc' );
  209.  
  210. // Icons path.
  211. define( 'CONSULTSTREET_PARENT_INC_ICON_URI', CONSULTSTREET_PARENT_URI . '/assets/img/icons' );
  212. // Customizer path.
  213. define( 'CONSULTSTREET_PARENT_CUSTOMIZER_DIR', CONSULTSTREET_PARENT_INC_DIR . '/customizer' );
  214.  
  215. // Theme version.
  216. $consultstreet_theme = wp_get_theme();
  217. define( 'CONSULTSTREET_THEME_VERSION', $consultstreet_theme->get( 'Version' ) );
  218.  
  219. // Set default content width.
  220. if ( ! isset( $content_width ) ) {
  221. $content_width = 800;
  222. }
  223.  
  224. /**
  225. * Implement the Custom Header feature.
  226. */
  227. require CONSULTSTREET_PARENT_INC_DIR . '/custom-header.php';
  228.  
  229. /**
  230. * Custom template tags for this theme.
  231. */
  232. require CONSULTSTREET_PARENT_INC_DIR . '/template-tags.php';
  233.  
  234. /**
  235. * Functions which enhance the theme by hooking into WordPress.
  236. */
  237. require CONSULTSTREET_PARENT_INC_DIR . '/template-functions.php';
  238.  
  239. /**
  240. * Customizer additions.
  241. */
  242. require CONSULTSTREET_PARENT_INC_DIR . '/customizer/consultstreet-customizer.php';
  243. require CONSULTSTREET_PARENT_INC_DIR . '/customizer/customizer-page-editor/class/class-consultstreet-page-editor.php';
  244. require CONSULTSTREET_PARENT_INC_DIR . '/customizer/consultstreet-customizer-options.php';
  245. require CONSULTSTREET_PARENT_INC_DIR . '/customizer/consultstreet-customizer-default.php';
  246.  
  247.  
  248. /**
  249. * Pgge layout setting.
  250. */
  251.  
  252. require CONSULTSTREET_PARENT_INC_DIR . '/metabox.php';
  253. require CONSULTSTREET_PARENT_INC_DIR . '/custom-post.php';
  254. require CONSULTSTREET_PARENT_INC_DIR . '/custom-taxonomies.php';
  255.  
  256.  
  257. /**
  258. * Pgge layout setting.
  259. */
  260.  
  261. require CONSULTSTREET_PARENT_INC_DIR . '/theme-custom-color.php';
  262.  
  263. /**
  264. * Pgge layout setting.
  265. */
  266.  
  267. require CONSULTSTREET_PARENT_INC_DIR . '/theme-custom-typography.php';
  268.  
  269.  
  270. /**
  271. * Bootstrap class navwalker.
  272. */
  273.  
  274. require CONSULTSTREET_PARENT_INC_DIR . '/class-bootstrap-navwalker.php';
RAW Paste Data Copied