/** * Theme functions & definitations * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package eonfik */ /** * Define Theme Folder Path & URL Constant * @package eonfik * @since 1.0.0 */ define('EONFIK_THEME_ROOT', get_template_directory()); define('EONFIK_THEME_ROOT_URL', get_template_directory_uri()); define('EONFIK_INC', EONFIK_THEME_ROOT . '/inc'); define('EONFIK_THEME_SETTINGS', EONFIK_INC . '/theme-settings'); define('EONFIK_THEME_SETTINGS_IMAGES', EONFIK_THEME_ROOT_URL . '/inc/theme-settings/images'); define('EONFIK_TGMA', EONFIK_INC . '/plugins/tgma'); define('EONFIK_DYNAMIC_STYLESHEETS', EONFIK_INC . '/theme-stylesheets'); define('EONFIK_CSS', EONFIK_THEME_ROOT_URL . '/assets/css'); define('EONFIK_JS', EONFIK_THEME_ROOT_URL . '/assets/js'); define('EONFIK_ASSETS', EONFIK_THEME_ROOT_URL . '/assets'); define('EONFIK_DEV', true); /** * Theme Initial File * @package eonfik * @since 1.0.0 */ if (file_exists(EONFIK_INC . '/theme-init.php')) { require_once EONFIK_INC . '/theme-init.php'; } /** * Codester Framework Functions * @package eonfik * @since 1.0.0 */ if (file_exists(EONFIK_INC . '/theme-cs-function.php')) { require_once EONFIK_INC . '/theme-cs-function.php'; } /** * Theme Helpers Functions * @package eonfik * @since 1.0.0 */ if (file_exists(EONFIK_INC . '/theme-helper-functions.php')) { require_once EONFIK_INC . '/theme-helper-functions.php'; if (!function_exists('eonfik')) { function eonfik() { return class_exists('Eonfik_Helper_Functions') ? new Eonfik_Helper_Functions() : false; } } } /** * Nav menu fallback function * @since 1.0.0 */ if (is_user_logged_in()) { function eonfik_theme_fallback_menu() { get_template_part('template-parts/default', 'menu'); } } // theme-color if (file_exists(EONFIK_INC . '/theme-color.php')) { require_once EONFIK_INC . '/theme-color.php'; } if(class_exists('WooCommerce')){ require_once EONFIK_INC . '/woocommerce.php'; } // register_block_style function eonfik_register_block_styles() { register_block_style( 'core/paragraph', array( 'name' => 'fancy-paragraph', 'label' => __( 'Fancy Paragraph', 'eonfik' ), ) ); } add_action( 'init', 'eonfik_register_block_styles' ); // register_block_pattern function eonfik_register_block_patterns() { register_block_pattern( 'eonfik/hero-section', array( 'title' => __( 'Hero Section', 'eonfik' ), 'description' => _x( 'A custom hero section with image and text', 'Block pattern description', 'eonfik' ), 'content' => '
Your content here...
', ) ); } add_action( 'init', 'eonfik_register_block_patterns' ); // custom-header function eonfik_custom_header_setup() { add_theme_support( 'custom-header', array( 'default-image' => get_template_directory_uri() . '/inc/theme-settings/images/header/00.png', 'width' => 1000, 'height' => 250, 'flex-width' => true, 'flex-height' => true, ) ); } add_action( 'after_setup_theme', 'eonfik_custom_header_setup' ); // custom-background function eonfik_custom_background_setup() { add_theme_support( 'custom-background', array( 'default-color' => 'ffffff', ) ); } add_action( 'after_setup_theme', 'eonfik_custom_background_setup' ); // add action add_action('woocommerce_shop_loop_item_title', 'eonfik_wc_loop_product_title', 10); add_action('woocommerce_before_shop_loop_item_title', 'eonfik_wc_loop_product_thumbnail', 10); add_action('woocommerce_after_shop_loop_item_title', 'eonfik_wc_loop_rating_loop_price', 10); // woocommerce filter wrapper hook add_action('woocommerce_before_shop_loop','eonfik_wc_filter_wrapper',20); // single product price and rating add_action('woocommerce_single_product_summary', 'eonfik_woocommerce_single_product_price_rating', 20 ); // remove actions remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); remove_action('woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10); remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10); remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10); remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5); remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10); // single product page // remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20); // remove showing result & default sorting remove_action('woocommerce_before_shop_loop','woocommerce_result_count',20); remove_action('woocommerce_before_shop_loop','woocommerce_catalog_ordering',30); // removing single product hooks // remove_action('woocommerce_single_product_summary','woocommerce_template_single_rating',10); // Add filter add_filter( 'woocommerce_show_page_title' , 'eonfik_wc_show_page_title' );