/** * thim functions and definitions * * @package thim */ /** * Set the content width based on the theme's design and stylesheet. */ if ( ! isset( $content_width ) ) { $content_width = 640; /* pixels */ } define( 'THIM_DIR', trailingslashit( get_template_directory() ) ); define( 'THIM_URI', trailingslashit( get_template_directory_uri() ) ); if ( ! function_exists( 'thim_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function thim_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on thim, use a find and replace * to change 'garage' to the name of your theme in all the template files */ load_theme_textdomain( 'garage', THIM_DIR . 'languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in two location. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'garage' ), ) ); register_nav_menus( array( 'secondary' => esc_html__( 'Secondary Menu', 'garage' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'video', 'gallery', ) ); add_theme_support( "title-tag" ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'thim_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); add_post_type_support( 'page', 'excerpt' ); // Add image size add_image_size( 'thim-slider-posts-size', 370, 214, true ); add_image_size( 'thim-thumbnail', 120, 100, true ); // $args = array( // 'flex-width' => true, // 'width' => 1350, // 'flex-height' => true, // 'height' => 500, // 'default-image' => THIM_URI . 'images/bg_header.jpg', // ); // add_theme_support( 'custom-header', $args ); add_editor_style(); } endif; // thim_setup add_action( 'after_setup_theme', 'thim_setup' ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function thim_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'garage' ), 'id' => 'sidebar-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Top', 'garage' ), 'id' => 'footer-subscribe', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Left', 'garage' ), 'id' => 'footer-left', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Middle 1', 'garage' ), 'id' => 'footer-mid-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Middle 2', 'garage' ), 'id' => 'footer-mid-2', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Right', 'garage' ), 'id' => 'footer-right', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Header Top Sidebar', 'garage' ), 'id' => 'toolbar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Shop', 'garage' ), 'id' => 'sidebar-shop', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Menu right', 'garage' ), 'id' => 'menu_right', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'thim_widgets_init' ); /** * Enqueue scripts and styles. */ function thim_scripts() { if ( is_multisite() ) { $stylesheet_uri_multi = get_template_directory_uri() . '/style-' . get_current_blog_id() . '.css'; wp_enqueue_style( 'thim-style', apply_filters( 'thim_stylesheet_multisite', $stylesheet_uri_multi, get_current_blog_id() ) ); } else { wp_enqueue_style( 'thim-style', get_stylesheet_uri() ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'framework-bootstrap', THIM_URI . 'js/bootstrap.min.js', array( 'jquery' ) ); wp_enqueue_script( 'thim-main', THIM_URI . 'js/main.min.js', array( 'jquery', 'framework-bootstrap' ) ); wp_enqueue_script( 'thim-custom-script', THIM_URI . 'js/custom-script.js', array( 'thim-main' ), '', true ); } add_action( 'wp_enqueue_scripts', 'thim_scripts' ); // Require library require THIM_DIR . 'inc/libs/class-tgm-plugin-activation.php'; require THIM_DIR . 'inc/libs/theme-wrapper.php'; require THIM_DIR . 'inc/libs/tax-meta-class/Tax-meta-class.php'; require THIM_DIR . 'inc/libs/custom-export.php'; // Require plugins if ( is_admin() && current_user_can( 'manage_options' ) ) { require THIM_DIR . 'inc/admin/plugins-require.php'; } // require require THIM_DIR . 'inc/custom-functions.php'; require THIM_DIR . 'inc/hkt.php'; require THIM_DIR . 'inc/aq_resizer.php'; if (class_exists('TP_Event')) { require get_template_directory() . '/tp-event/functions.php'; } /** * Custom template tags for this theme. */ require THIM_DIR . 'inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require THIM_DIR . 'inc/extras.php'; // dislay setting layout require THIM_DIR . 'inc/wrapper-before-after.php'; // Includes widgets require THIM_DIR . 'inc/widgets/widgets.php'; include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( is_plugin_active( 'thim-framework/tp-framework.php' ) ) { require THIM_DIR . 'inc/admin/customize-options.php'; require THIM_DIR . 'inc/tax-meta.php'; }