* @copyright Copyright (c) 2013-2014, Arthur Gareginyan * @link http://mycyberuniverse.com/anarcho-notepad.html * @license http://www.gnu.org/licenses/gpl-3.0.html */ // Ladies, Gentalmen, boys and girls let's start our engine add_action('after_setup_theme', 'anarcho_notepad_setup'); function anarcho_notepad_setup() { global $content_width; // Localization Init load_theme_textdomain( 'anarcho-notepad', get_template_directory() . '/languages' ); // This feature enables Custom Backgrounds. add_theme_support( 'custom-background', array( 'default-image' => get_template_directory_uri() . '/images/background.jpg', ) ); // This feature enables Custom Header. add_theme_support( 'custom-header', array( 'flex-width' => true, 'width' => 500, 'flex-height' => true, 'height' => 150, //'default-text-color' => '#e5e5e5', 'header-text' => true, //'default-image' => get_template_directory_uri() . '/images/logotype.jpg', 'uploads' => true, ) ); // This feature enables Featured Images (also known as post thumbnails). add_theme_support('post-thumbnails'); set_post_thumbnail_size(540,230,!1); // This feature enables post and comment RSS feed links to . add_theme_support('automatic-feed-links'); // Add HTML5 elements add_theme_support( 'html5', array( 'comment-list', 'search-form', 'comment-form', ) ); // This feature enables menu. register_nav_menus( array( 'primary' => __( 'Primary', 'anarcho-notepad' ) )); // This feature enables Link Manager in Admin page. add_filter( 'pre_option_link_manager_enabled', '__return_true' ); // Add Callback for Custom TinyMCE editor stylesheets. (editor-style.css) add_editor_style(); } // Add Theme Information Page. require get_template_directory() . '/inc/theme_info.php'; // Add Theme Customizer functionality. require get_template_directory() . '/inc/customizer.php'; // Add IE conditional HTML5 shim to header function anarcho_add_ie_html5_shim () { global $is_IE; if ($is_IE) echo ''; } add_action('wp_head', 'anarcho_add_ie_html5_shim'); // This feature enables sidebar. function anarcho_widgets_init() { register_sidebar(array( 'name' => __('Sidebar Area 1', 'anarcho-notepad'), 'id' => 'sidebar-1', 'description' => __('Widgets in this area will be shown below "Pages".', 'anarcho-notepad'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __('Sidebar Area 2', 'anarcho-notepad'), 'id' => 'sidebar-2', 'description' => __('Widgets in this area will be shown below "What is this place".', 'anarcho-notepad'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __('Sidebar Area 3', 'anarcho-notepad'), 'id' => 'sidebar-3', 'description' => __('Widgets in this area will be shown below "Frends & Links".', 'anarcho-notepad'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __('Sidebar Area 4', 'anarcho-notepad'), 'id' => 'sidebar-4', 'description' => __('Widgets in this area will be shown below "Recent Posts".', 'anarcho-notepad'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); } add_action( 'widgets_init', 'anarcho_widgets_init' ); // Adds a custom default avatar function anarcho_avatar( $avatar_defaults ) { $myavatar = get_stylesheet_directory_uri() . '/images/anarchy-symbol.png'; $avatar_defaults[$myavatar] = 'Anarcho symbol'; return $avatar_defaults; } add_filter( 'avatar_defaults', 'anarcho_avatar' ); // Include Font-Awesome styles function anarcho_include_font_awesome_styles() { wp_register_style( 'font_awesome_styles', get_template_directory_uri() . '/fonts/font-awesome-4.0.0/font-awesome.min.css', 'screen' ); wp_enqueue_style( 'font_awesome_styles' ); } add_action( 'wp_enqueue_scripts', 'anarcho_include_font_awesome_styles' ); // Enable smoothscroll.js function include_smoothscroll_script() { wp_enqueue_script( 'back-top', get_template_directory_uri() . '/js/smoothscroll.js', array( 'jquery' ), '', true ); } add_action( 'wp_enqueue_scripts', 'include_smoothscroll_script' ); // Display block "About the Author". function anarcho_author_bio() { if(get_theme_mod('disable_about_bio') == '0') { if ( ( get_the_author_meta( 'description' ) != '' ) ) echo esc_html(get_template_part( 'author-bio' )); } } // Red data ribbons. function anarcho_ribbons() { if(get_theme_mod('disable_ribbons') == '0') { if(get_theme_mod('enable_year_ribbons') == '0') { if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '', esc_url( get_permalink() ) ); } printf( '
%1$s %2$s
', esc_attr( get_the_date('F') ), esc_attr( get_the_date('j') ) ); if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '
' ); } } else { if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '', esc_url( get_permalink() ) ); } printf( '
%1$s %2$s
', esc_attr( get_the_date('F j') ), esc_attr( get_the_date('Y') ) ); if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '
' ); } } } } // END-Red Data Ribbons // Enable Breadcrumbs function anarcho_breadcrumbs() { if(get_theme_mod('enable_breadcrumbs') == '1') { $delimiter = '»'; $before = ''; $after = ''; echo ''; } } // END-Breadcrumbs // Page Navigation /* Display navigation to next/previous set of posts when applicable. */ function anarcho_page_nav() { if(get_theme_mod('enable_page-nav') == '1') { global $wp_query, $wp_rewrite; $pages = ''; $max = $wp_query->max_num_pages; if (!$current = get_query_var('paged')) $current = 1; $a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999)); $a['total'] = $max; $a['current'] = $current; $total = 0; $a['mid_size'] = 3; $a['end_size'] = 1; $a['prev_text'] = __('Previous page', 'anarcho-notepad'); $a['next_text'] = __('Next page', 'anarcho-notepad'); if ($max > 0) echo '
'; } else { global $wp_query; // Don't print empty markup if there's only one page. if ( $wp_query->max_num_pages < 2 ) return; ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; ?> comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    %1$s %2$s', get_comment_author_link(), // If current post author is also comment author, make it known visually. ( $comment->user_id === $post->post_author ) ? '' . __( '(Post author) ', 'anarcho-notepad' ) . '' : '' ); printf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), /* translators: 1: date, 2: time */ sprintf( '%1$s at %2$s', get_comment_date(), get_comment_time() ) ); ?>
    comment_approved ) : ?>

    ', '

    ' ); ?>
    __( 'Reply', 'anarcho-notepad' ), 'after' => ' ', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    '

    ' . ' ' . ( $req ? '*' : '' ) . '

    ', 'email' => '

    ' . ( $req ? '*' : '' ) . '

    ', 'url' => '

    ' . '

    ', ); $anarcho_defaults['fields'] = apply_filters( 'comment_form_default_fields', $anarcho_fields); $anarcho_defaults['comment_field'] = '

    '; $anarcho_defaults['title_reply'] = __('Leave a Comment', 'anarcho-notepad'); return $anarcho_defaults; } add_filter('comment_form_defaults', 'anarcho_comment_form'); // END-Comments-Form // END-Comments // Creates a nicely formatted and more specific title element text // for output in head of document, based on current view. function anarcho_wp_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', 'anarcho-notepad' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'anarcho_wp_title', 10, 2 ); // Copyright /* Enable info about copyright. */ function anarcho_copyright() { if(get_theme_mod('disable_anarcho_copy') == '0') { echo 'Theme "Anarcho Notepad" designed and engineered by Arthur (Berserkr) Gareginyan.
    '; } } add_action ('wp_footer','anarcho_copyright', 999); // END-Copyright // Queries /* Display info about a database queries. */ function anarcho_mysql_queries() { if(get_theme_mod('show_info_line') == '1') { echo "\n"; echo get_num_queries(); _e(' queries in ', 'anarcho-notepad'); timer_stop(1); _e(' seconds', 'anarcho-notepad'); echo ' / '; echo round(memory_get_usage()/1024/1024, 2); _e(' mb', 'anarcho-notepad'); echo "\n"; } } add_action ('wp_footer','anarcho_mysql_queries', 999); // END-Queries // Top Button /* Enable Top Button. */ function anarcho_top_button() { if(get_theme_mod('disable_top_button') == '0') { echo ''; } } add_action ('wp_footer','anarcho_top_button', 999); // END-Top Button // Scripts /* Enable scripts in footer. */ function anarcho_scripts_footer() { echo ''; } add_action ('wp_footer','anarcho_scripts_footer', 999); // END-Scripts ?>