& $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 '
  • '; echo '
    '; echo '
    '; echo ''; echo myThemes::gravatar( $comment -> comment_author_email , 50 ); echo ''; echo ''; comment_reply_link( array_merge( $args , array( 'reply_text' => __( 'Reply', 'myThemes' ), 'before' => '', 'after' => '', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); echo ''; echo ''; echo get_comment_author_link( $comment -> comment_ID ); echo ''; echo '
    '; echo '
    '; echo '

    '; if ( $comment -> comment_approved == '0' ) { echo ''; _e( 'Your comment is awaiting moderation.' , 'myThemes' ); echo ''; } echo get_comment_text(); echo '

    '; echo '
    '; echo '
  • '; break; } case 'pingback' :{ } case 'trackback' : { break; } } } /* RETURN NUMBER OFF CURRENT BLOG PAGE */ static function pagination() { global $wp_query; if( (int) get_query_var('paged') > 0 ){ $paged = get_query_var('paged'); }else{ if( (int) get_query_var('page') > 0 ){ $paged = get_query_var('page'); }else{ $paged = 1; } } return $paged; } /* DISPLAY BLOG TITLE */ static function title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; /*/ Add the site name. */ $title .= get_bloginfo( 'name' ); /*/ Add the site description for the home/front page. */ $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; /*/ Add a page number if necessary. */ if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'myThemes' ), max( $paged, $page ) ); return $title; } static function favicon( $settings = 'favicon' ) { if( myThemes::get( $settings ) ){ echo ''; } else{ if( file_exists( get_template_directory() . '/favicon.ico' ) ) echo ''; } } static function ajaxurl() { echo ''; } static function group() { return "myThemes"; } static function name() { $theme = wp_get_theme(); return $theme -> title; } static function version() { $theme = wp_get_theme(); return $theme -> version; } } ?>