run_classes();
if ( self::THEME_NAME == 'AppTheme' && class_exists( 'AppPresser_Admin_Settings' ) && file_exists( APPP_THEME_PATH .'appp-settings.php' ) )
require_once( APPP_THEME_PATH .'appp-settings.php' );
// setup our theme
$this->run_hooks( array( array( 'after_setup_theme', 'after_setup_theme' ) ) );
}
/**
* Adds our extra functionality classes
* @since 0.0.1
*/
protected function run_classes() {
// Load custom app functionality.
$this->App_Functionality = new AppPresser_App_Functionality();
$this->run_hooks( 'App_Functionality' );
// Custom functions that act independently of the theme templates.
$this->Extra_Functionality = new AppPresser_Extra_Functionality();
$this->run_hooks( 'Extra_Functionality' );
// Customizer additions.
$this->Customizer = new AppPresser_Customizer();
$this->run_hooks( 'Customizer' );
// Custom template tags
$this->Tags = new AppPresser_Tags();
$this->run_hooks( 'Tags' );
if( self::THEME_NAME == 'AppTheme' && file_exists( APPP_THEME_PATH . 'inc/classes/AppTheme_Pro.php') ) {
$this->AppTheme_Pro = new AppTheme_Pro();
$this->run_hooks( 'AppTheme_Pro' );
} else if( file_exists( APPP_THEME_PATH . 'inc/classes/AppTheme_Free.php') ) {
$this->AppTheme_Free = new AppTheme_Free();
$this->run_hooks( 'AppTheme_Free' );
$this->AppTheme_Admin_Settings = new AppTheme_Admin_Settings();
$this->run_hooks('AppTheme_Admin_Settings');
}
// Load Jetpack compatibility file.
// $this->Jetpack = new AppPresser_Jetpack();
// $this->run_hooks( 'Jetpack' );
}
/**
* 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.
*/
public function after_setup_theme() {
add_theme_support( 'title-tag' );
// Gets rid of woo no theme support message
add_theme_support( 'woocommerce' );
// Our theme check condition.
add_theme_support( 'apppresser' );
// Add custom editor styles
add_editor_style( 'editor-style.css' );
// Set the content width based on the theme's design and stylesheet.
if ( ! isset( $content_width ) )
$content_width = 1024; /* pixels */
$this->run_hooks( array(
array( 'wp_enqueue_scripts', 'scripts_styles' ),
array( 'wp_page_menu', 'add_menuclass' ),
) );
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
*/
load_theme_textdomain( 'apptheme-free', APPP_THEME_PATH . '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' );
add_image_size( 'logo', 500, 100 ); // Header logo. Works cause it's in the customizer
// Custom image sizes won't do anything if theme is inactive
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'apptheme-free' ),
'top' => __( 'Top Menu', 'apptheme-free' ),
'top2' => __( 'Top Menu 2', 'apptheme-free' ),
//'panel-menu' => __('App Panel Menu', 'apptheme-free' ),
'footer-menu' => __('Footer Menu', 'apptheme-free' )
) );
$this->run_hooks( array(
// Hook in page title or appp logo
array( 'appp_page_title', 'do_page_title' ),
// Add body classes
array( 'body_class', 'bodyclasses' ),
) );
}
/**
* Adds customizer logo or page title to the nav bar
* @since 0.0.1
*/
public function do_page_title() {
// If we have a logo, show that
if ( $logo = appp_has_logo() ) {
$blog_title = esc_attr( get_bloginfo( 'name', 'display' ) );
// Try to get attachment ID from logo url
if( $id = AppPresser_Tags::image_id_from_url( $logo ) ) {
// If we have an ID, get a smaller image
$logo = wp_get_attachment_image( $id, 'logo', false, array( 'id' => 'site-logo' ) );
} else {
// Otherwise, use the original
$logo = '';
}
?>