functions.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * Kiosko functions and definitions
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6. *
  7. * @package Kiosko
  8. * @since Kiosko 1.0
  9. */
  10. if ( ! function_exists( 'kiosko_support' ) ) :
  11. /**
  12. * Sets up theme defaults and registers support for various WordPress features.
  13. *
  14. * @since Kiosko 1.0
  15. *
  16. * @return void
  17. */
  18. function kiosko_support() {
  19. // Enqueue editor styles.
  20. add_editor_style( 'style.css' );
  21. // Make theme available for translation.
  22. load_theme_textdomain( 'kiosko' );
  23. }
  24. endif;
  25. add_action( 'after_setup_theme', 'kiosko_support' );
  26. if ( ! function_exists( 'kiosko_styles' ) ) :
  27. /**
  28. * Enqueue styles.
  29. *
  30. * @since Kiosko 1.0
  31. *
  32. * @return void
  33. */
  34. function kiosko_styles() {
  35. // Register theme stylesheet.
  36. $theme_version = wp_get_theme()->get( 'Version' );
  37. $version_string = is_string( $theme_version ) ? $theme_version : false;
  38. wp_register_style(
  39. 'kiosko-style',
  40. get_template_directory_uri() . '/style.css',
  41. array(),
  42. $version_string
  43. );
  44. // Enqueue theme stylesheet.
  45. wp_enqueue_style( 'kiosko-style' );
  46. // Enqueue the additional stylesheet for Twenty Twenty Three.
  47. if ( class_exists( 'WooCommerce' ) && function_exists( 'WC' ) && defined( 'WC_ABSPATH' ) && file_exists( WC_ABSPATH . 'assets/css/twenty-twenty-three.css' ) ) {
  48. wp_enqueue_style( 'woocommerce-twenty-twenty-three', WC()->plugin_url() . '/assets/css/twenty-twenty-three.css' );
  49. wp_dequeue_style( 'woocommerce-general' );
  50. }
  51. }
  52. endif;
  53. add_action( 'wp_enqueue_scripts', 'kiosko_styles' );
  54. if ( ! function_exists( 'kiosko_woocommerce_init' ) ) :
  55. /**
  56. * Initialize WooCommerce compatibility.
  57. *
  58. * @since Kiosko 1.0
  59. * @return void
  60. */
  61. function kiosko_woocommerce_init() {
  62. if ( ! class_exists( 'WooCommerce' ) || ! defined( 'WC_ABSPATH' ) || ! file_exists( WC_ABSPATH . 'includes/theme-support/class-wc-twenty-twenty-three.php' ) ) {
  63. return;
  64. }
  65. // Load WooCommerce compatibility file if WooCommerce is loaded and the compatibility file exists.
  66. include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-twenty-three.php';
  67. }
  68. endif;
  69. add_action( 'after_setup_theme', 'kiosko_woocommerce_init' );