& $d ){ add_filter( $filter , $d ); } } } /* INIT ACTIONS */ static function init_actions() { $actions = self::cfg( 'actions' ); if( !empty( $actions ) && is_array( $actions ) ){ foreach( $actions as $action => & $d ){ add_action( $action , $d ); } } } /* INIT SCRIPTS */ static function init_scripts() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'functions' , get_template_directory_uri() . '/media/js/functions.js' ); wp_enqueue_script( 'js-pretty-photo', get_template_directory_uri( ) . '/media/js/jquery.prettyPhoto.js' ); wp_enqueue_script( 'settings-pretty-photo', get_template_directory_uri( ) . '/media/js/settings.prettyPhoto.js' ); wp_enqueue_style( 'css-pretty-photo', get_template_directory_uri( ) . '/media/css/prettyPhoto.css' ); /* INCLUDE FOR REPLY COMMENTS */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); /* INCLUDE STYLE.CSS */ wp_enqueue_style( 'mythemes-style', get_stylesheet_uri() ); } /* REGISTER THEME MENUS */ static function reg_menus( ) { register_nav_menus( self::cfg( 'menus' ) ); } /* REGISTER THEME SIDEBARS */ static function reg_sidebars( ) { $sidebars = self::cfg( 'sidebars' ); if( !empty( $sidebars ) && is_array( $sidebars ) ){ foreach( $sidebars as $sidebar ){ register_sidebar( $sidebar ); } } /* CUSTOM SIDEBARS */ $custom = sett::get( self::cfg( 'custom-sidebars' ) ); if( !empty( $custom ) && is_array( $custom ) ){ foreach( $custom as $s ){ $sidebars[0][ 'name' ] = $s; $sidebars[0][ 'id' ] = strtolower( str_replace( ' ' , '-' , $s ) ); $sidebars[0][ 'description' ] = __( 'Additional custom sidebar' , 'myThemes' ); register_sidebar( $sidebars[ 0 ] ); } } } static function sidebars() { $sidebars = array( 'main-sidebar' => __( 'Main sidebar' , 'myThemes' ) ); $custom = sett::get( self::cfg( 'custom-sidebars' ) ); if( !empty( $custom ) ){ foreach( $custom as $s ){ $sidebars[ strtolower( str_replace( ' ' , '-' , $s ) ) ] = $s; } } return $sidebars; } static function setup() { load_theme_textdomain( 'myThemes' ); load_theme_textdomain( 'myThemes' , get_template_directory() . '/media/languages' ); if ( function_exists( 'load_child_theme_textdomain' ) ){ load_child_theme_textdomain( 'myThemes' ); } add_editor_style(); add_theme_support( 'custom-background', array( 'default-color' => 'fafafa', 'default-image' => '' ) ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 630, 9999 ); $args = array( 'default-text-color' => '000000', 'wp-head-callback' => array( 'myThemes' , 'custom_style' ), 'default-image' => '', 'random-default' => false, 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'header-text' => true, 'uploads' => false, 'admin-head-callback' => array( 'myThemes' , 'admin_header' ) ); add_theme_support( 'custom-header', $args ); } static function admin_header() { ?> ID ) ){ $content = '' . get_the_post_thumbnail( $post -> ID, 'small-thumb' , array( 'style' => 'float:left; margin:0 15px 15px 0;' ) ) . '' . $content; } return $content; } static function gravatar( $authorID , $size, $default = '' ) { if( get_user_meta( $authorID , 'avatar' , true ) == -1 ){ $result = ''; }else{ if( get_user_meta( $authorID , 'avatar' , true ) > 0 ){ $avatar_info = wp_get_attachment_image_src( get_user_meta( $authorID , 'avatar' , true ) , array( $size , $size ) ); $result = ''; }else{ $result = get_avatar( $authorID , $size , $default ); } } return $result; } static function comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment -> comment_type ) { case '' : { echo '
'; if ( $comment -> comment_approved == '0' ) { echo ''; _e( 'Your comment is awaiting moderation.' , 'myThemes' ); echo ''; } echo get_comment_text(); echo '
'; echo '