Пример #1
0
/**
 * Add custom ubermenu skin.
 *
 */
function presscore_ubermenu_add_custom_skin()
{
    $cache_name = 'wp_less_stylesheet_data_' . md5(PRESSCORE_THEME_DIR . '/css/the7-uber-menu.less');
    $compiled_cache = get_option($cache_name);
    if (!(is_admin() || dt_is_login_page())) {
        if (defined('DT_ALWAYS_REGENERATE_DYNAMIC_CSS') && DT_ALWAYS_REGENERATE_DYNAMIC_CSS || $compiled_cache !== false && empty($compiled_cache['target_uri'])) {
            presscore_generate_less_css_file('the7-ubermenu.less', PRESSCORE_THEME_URI . '/css/the7-uber-menu.less');
            $compiled_cache = get_option($cache_name);
        }
    }
    $stylesheet_src = isset($compiled_cache['target_uri']) ? $compiled_cache['target_uri'] : false;
    // less stylesheet
    if (get_option('presscore_less_css_is_writable') && $stylesheet_src) {
        // print custom css inline
    } elseif (!empty($compiled_cache['compiled'])) {
        wp_add_inline_style('dt-main', $compiled_cache['compiled']);
    }
    ubermenu_register_skin('the7-style', _x('The7 skin', 'backend', LANGUAGE_ZONE), $stylesheet_src);
}
Пример #2
0
	/**
	 * 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 post thumbnails.
	 *
	 * @since presscore 1.0
	 */
	function presscore_setup() {

		/**
		 * Editor style.
		 */
		add_editor_style();

		/**
		 * Add default posts and comments RSS feed links to head
		 */
		add_theme_support( 'automatic-feed-links' );

		/**
		 * Enable support for Post Thumbnails
		 */
		add_theme_support( 'post-thumbnails' );

		/**
		 * This theme uses wp_nav_menu() in one location.
		 */
		register_nav_menus( array(
			'primary' 	=> __( 'Primary Menu', LANGUAGE_ZONE ),
			'top'		=> __( 'Top Menu', LANGUAGE_ZONE ),
			'bottom'	=> __( 'Bottom Menu', LANGUAGE_ZONE ),
		) );

		/**
		 * Enable support for Post Formats
		 */
		add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'chat', 'status' ) );

		/**
		 * Allow shortcodes in widgets.
		 *
		 */
		add_filter( 'widget_text', 'do_shortcode' );

		// create upload dir
		wp_upload_dir();

		/**
		 * Include AQResizer.
		 *
		 */
		require_once( PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php' );

		/**
		 * Include core functions.
		 *
		 */
		require_once( PRESSCORE_EXTENSIONS_DIR . '/core-functions.php' );

		/**
		 * Include stylesheet related functions.
		 *
		 */
		require_once( PRESSCORE_EXTENSIONS_DIR . '/stylesheet-functions.php' );

		/**
		 * Include options framework if it is not installed like plugin.
		 *
		 */
		if ( !defined('OPTIONS_FRAMEWORK_VERSION') ) {

			// Base
			require_once( PRESSCORE_EXTENSIONS_DIR . '/options-framework/options-framework.php' );

			if ( current_user_can( 'edit_theme_options' ) ) {

				// add theme options
				add_filter( 'options_framework_location', 'presscore_add_theme_options' );
			}
		}

		/**
		 * Include custom post typest.
		 *
		 */
		require_once( PRESSCORE_DIR . '/post-types.php' );

		if ( !class_exists('Mobile_Detect') ) {

			/**
			 * Mobile detection library.
			 *
			 */
			require_once( PRESSCORE_EXTENSIONS_DIR . '/mobile-detect.php' );

		}

		/**
		 * Some additional classes ( remove in future ).
		 *
		 */
		require_once( PRESSCORE_CLASSES_DIR . '/tags.class.php' );

		/**
		 * Include helpers.
		 *
		 */
		require_once( PRESSCORE_DIR . '/helpers.php' );

		$current_page_name = dt_get_current_page_name();
		$is_backend = is_admin() || dt_is_login_page();

		if ( function_exists('vc_is_inline') && vc_is_inline() ) {
			$is_backend = false;
		}

		/**
		 * Include admin functions.
		 *
		 */
		if ( $is_backend && is_admin() ) {

			/**
			 * Include the TGM_Plugin_Activation class.
			 */
			require_once( PRESSCORE_EXTENSIONS_DIR . '/class-tgm-plugin-activation.php' );

			// include only for theme update page
			if ( 'admin.php' == $current_page_name && !empty($_GET['page']) && 'of-themeupdate-menu' == $_GET['page'] ) {

				/**
				 * Update library.
				 *
				 */
				require_once( PRESSCORE_EXTENSIONS_DIR . '/envato-wordpress-toolkit-library/class-envato-wordpress-theme-upgrader.php' );
			}

			/**
			 * Attach metaboxes.
			 *
			 */
			require_once( PRESSCORE_EXTENSIONS_DIR . '/meta-box.php' );
			if ( $located_file = locate_template( 'inc/admin/metaboxes.php' ) ) {
				include_once( $located_file );
			}

			require_once( PRESSCORE_ADMIN_DIR . '/admin-functions.php' );

		} else if ( !$is_backend ) {

			/**
			 * Include custom menu.
			 *
			 */
			require_once( PRESSCORE_EXTENSIONS_DIR . '/core-menu.php' );

			/**
			 * Include template actions and filters.
			 *
			 */
			require_once( PRESSCORE_DIR . '/template-tags.php' );

			/**
			 * Include paginator.
			 *
			 */
			require_once( PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php' );

		}

		/**
		 * Include widgets.
		 *
		 */

		/* Widgets list */
		$presscore_widgets = array(
			'contact-info.php',
			'custom-menu-1.php',
			'custom-menu-2.php',
			'blog-posts.php',
			'blog-categories.php',
			'flickr.php',
			'portfolio.php',
			'progress-bars.php',
			'testimonials-list.php',
			'testimonials-slider.php',
			'team.php',
			'logos.php',
			'photos.php',
			'contact-form.php',
			'accordion.php',
		);

		$presscore_widgets = apply_filters( 'presscore_widgets', $presscore_widgets );

		// include widgets only for frontend and widgets admin page
		if ( $presscore_widgets && ( in_array($current_page_name, array('widgets.php', 'admin-ajax.php', 'themes.php')) || !$is_backend ) ) {

			foreach ( $presscore_widgets as $presscore_widget ) {

				if ( $file_path = locate_template( 'inc/widgets/' . $presscore_widget ) ) {
					require_once( $file_path );
				}
			}

		}

		// List of shortcodes folders to include
		// All folders located in /include
		$presscore_shortcodes = array(
			'columns',
			'box',
			'gap',
			'divider',
			'stripes',

			'fancy-image',
			'list',
			'button',
			'tooltips',
			'highlight',
			'code',

			'tabs',
			'accordion',
			'toggles',

			'quote',
			'call-to-action',
			'shortcode-teasers',
			'banner',
			'benefits',
			'progress-bars',
			'contact-form',
			'social-icons',
			'map',

			'blog-posts-small',
			'blog-posts',
			'portfolio',
			'portfolio-jgrid',
			'portfolio-slider',
			'small-photos',
			'slideshow',
			'team',
			'testimonials',
			'logos',

			'gallery',

			'animated-text',

			'list-vc',
			'benefits-vc',
			'fancy-video-vc',
			'fancy-titles-vc',
			'fancy-separators-vc'
		);
		$presscore_shortcodes = apply_filters( 'presscore_shortcodes', $presscore_shortcodes );


		// include shortcodes only for frontend and post admin pages
		if ( $presscore_shortcodes && ( in_array( $current_page_name, array('post.php', 'post-new.php', 'admin-ajax.php') ) || !$is_backend ) ) {

			/**
			 * Setup shortcodes.
			 *
			 */
			require_once( PRESSCORE_SHORTCODES_DIR . '/setup.php' );

			foreach ( $presscore_shortcodes as $shortcode_dirname ) {
				include_once( PRESSCORE_SHORTCODES_INCLUDES_DIR . '/' . $shortcode_dirname . '/functions.php' );
			}
		}

		if ( apply_filters( 'presscore_enable_theme_mega_menu', true ) ) {
			include PRESSCORE_CLASSES_DIR . '/mega-menu.class.php';
			$mega_menu = new Dt_Mega_menu();
		}

		/**
		 * Add woocommerce support.
		 *
		 */
		if ( class_exists( 'Woocommerce' ) && $file_path = locate_template( 'inc/mod-woocommerce/mod-woocommerce.php' ) ) {
			require_once( $file_path );
		}

		if ( class_exists('UberMenu') ) {

			/**
			 * Add ubermenu support.
			 *
			 */
			require_once( PRESSCORE_DIR . '/mod-ubermenu/mod-ubermenu.php' );
		}

		// if Layer and Revolution sliders both active
		if ( defined('LS_PLUGIN_VERSION') && class_exists('UniteBaseClassRev') ) {

			/**
			 * Layer slider compatibility settings.
			 *
			 */
			require_once( PRESSCORE_DIR . '/mod-layerslider/mod-layerslider.php' );
		}

		if ( defined('W3TC') && W3TC && defined('W3TC_DYNAMIC_SECURITY') && W3TC_DYNAMIC_SECURITY ) {

			/**
			 * Total Cache settings.
			 *
			 */
			require_once( PRESSCORE_DIR . '/mod-totalcache/mod-totalcache.php' );
		}

		if ( function_exists('wp_cache_is_enabled') && wp_cache_is_enabled() && function_exists('add_cacheaction') ) {

			/**
			 * Super cache settings.
			 *
			 */
			require_once( PRESSCORE_DIR . '/mod-supercache/mod-supercache.php' );

		}

		if ( class_exists('SitePress') ) {

			/**
			 * WPML tricks.
			 *
			 */
			require_once( PRESSCORE_DIR . '/mod-wpml/mod-wpml.php' );
		}

		if ( class_exists('PG_Walker_Nav_Menu_Edit_Custom') ) {

			require_once( PRESSCORE_DIR . '/mod-private-content/mod-private-content.php' );
		}

		// the events calendar mod
		if ( class_exists('TribeEvents') ) {

			require_once( PRESSCORE_DIR . '/mod-the-events-calendar/mod-the-events-calendar.php' );
		}

		/////////////
		// Jetpack //
		/////////////

		if ( class_exists( 'Jetpack', false ) ) {
			include_once locate_template( 'inc/mod-jetpack/mod-jetpack.php' );
		}

	}