Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define( 'calypso_CSS', get_template_directory_uri().'/css/' );
- define( 'calypso_JS', get_template_directory_uri().'/js/' );
- define( 'calypso_DIR', get_template_directory() );
- /* -------------------------------------------
- * Include TGM Plugins
- * -------------------------------------------- */
- require_once( calypso_DIR . '/lib/class-tgm-plugin-activation.php');
- /* -------------------------------------------
- * Fontawesome Helper
- * -------------------------------------------- */
- require_once( calypso_DIR . '/lib/fontawesome-helper.php');
- /*-------------------------------------------*
- * Register Navigation
- *------------------------------------------*/
- register_nav_menus( array(
- 'primary' => esc_html__( 'Primary Menu', 'calypso' ),
- // 'footernav' => esc_html__( 'Footer Menu', 'calypso' ),
- ) );
- /*-------------------------------------------*
- * navwalker
- *------------------------------------------*/
- require_once( calypso_DIR . '/lib/menu/admin-megamenu-walker.php');
- require_once( calypso_DIR . '/lib/menu/meagmenu-walker.php');
- require_once( calypso_DIR . '/lib/menu/mobile-navwalker.php');
- add_filter( 'wp_edit_nav_menu_walker', function( $class, $menu_id ){
- return 'Themeum_Megamenu_Walker';
- }, 10, 2 );
- /*-------------------------------------------*
- * Startup Register
- *------------------------------------------*/
- require_once( calypso_DIR . '/lib/main-function/themeum-register.php');
- /*-------------------------------------------------------
- * Themeum Core
- *-------------------------------------------------------*/
- require_once( calypso_DIR . '/lib/main-function/themeum-core.php');
- require_once( calypso_DIR . '/woocommerce/jihad.php');
- function shipping_zones_shortcode() {
- $delivery_zones = WC_Shipping_Zones::get_zones();
- foreach ( (array) $delivery_zones as $key => $the_zone ) {
- echo ''.$the_zone['zone_name'].', ';
- echo ''.$the_zone['formatted_zone_location'].', ';
- echo ''.$the_zone['zone_locations'].', ';
- echo '<pre>';
- print_r($the_zone['shipping_methods']);
- echo '</pre>';
- // foreach ( $the_zone['shipping_methods'] as $zone ) {
- // echo '<pre>';
- // print_r($zone->method_description);
- // echo '</pre>';
- // }
- }
- }
- add_shortcode( 'list_shipping_zones', 'shipping_zones_shortcode', 10 );
- /*-----------------------------------------------------
- * Custom Excerpt Length
- *----------------------------------------------------*/
- if(!function_exists('calypso_excerpt_max_charlength')):
- function calypso_excerpt_max_charlength($charlength) {
- $excerpt = get_the_excerpt();
- $charlength++;
- if ( mb_strlen( $excerpt ) > $charlength ) {
- $subex = mb_substr( $excerpt, 0, $charlength - 5 );
- $exwords = explode( ' ', $subex );
- $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
- if ( $excut < 0 ) {
- return mb_substr( $subex, 0, $excut );
- } else {
- return $subex;
- }
- } else {
- return $excerpt;
- }
- }
- endif;
- /*-------------------------------------------
- * Custom Excerpt Length
- *-------------------------------------------*/
- if(!function_exists('crowdfunding_excerpt_max_charlength')):
- function crowdfunding_excerpt_max_charlength($str,$charlength) {
- $excerpt = $str;
- $charlength++;
- if ( mb_strlen( $excerpt ) > $charlength ) {
- $subex = mb_substr( $excerpt, 0, $charlength - 5 );
- $exwords = explode( ' ', $subex );
- $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
- if ( $excut < 0 ) {
- return mb_substr( $subex, 0, $excut );
- } else {
- return $subex;
- }
- } else {
- return $excerpt;
- }
- }
- endif;
- /* -------------------------------------------
- * Custom body class
- * ------------------------------------------- */
- add_filter( 'body_class', 'calypso_body_class' );
- function calypso_body_class( $classes ) {
- $layout = get_theme_mod( 'boxfull_en', 'fullwidth' );
- $classes[] = $layout.'-bg';
- return $classes;
- }
- /* -------------------------------------------
- * Logout Redirect Home
- * ------------------------------------------- */
- add_action( 'wp_logout', 'calypso_auto_redirect_external_after_logout');
- function calypso_auto_redirect_external_after_logout(){
- wp_redirect( home_url('/') );
- exit();
- }
- /* -------------------------------------------
- * Remove API
- * ------------------------------------------- */
- function calypso_remove_api() {
- remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
- remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
- }
- add_action( 'after_setup_theme', 'calypso_remove_api' );
- /* -------------------------------------------
- * SVG image upload
- * ------------------------------------------- */
- function calypso_mime_types( $mimes ){
- $mimes['svg'] = 'image/svg+xml';
- $mimes['svgz'] = 'image/svg+xml';
- return $mimes;
- }
- add_filter('upload_mimes', 'calypso_mime_types');
- /* -------------------------------------------
- * WooCommerce Product Column
- * ------------------------------------------- */
- add_filter('loop_shop_columns', 'loop_columns');
- if (!function_exists('loop_columns')) {
- function loop_columns() {
- return 3; # 3 products per row
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement