. add_theme_support( 'automatic-feed-links' ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'primary', __( 'Primary Menu', 'runo' ) ); // Add support for a variety of post formats add_theme_support( 'post-formats', array( 'gallery','quote', 'image' ) ); } endif; // runo_setup /** * Hook for Runo styles and fonts */ function runo_theme_styles() { $runo_language = get_bloginfo( 'language' ); if ($runo_language == 'ru-RU') { wp_register_style( 'runo-EBGaramond-font', 'http://fonts.googleapis.com/css?family=EB+Garamond&subset=latin,cyrillic-ext'); wp_register_style( 'runo-cyrillic-font', get_template_directory_uri() . '/fonts/cyrillic.css'); // enqueing: wp_enqueue_style( 'runo-EBGaramond-font' ); wp_enqueue_style( 'runo-cyrillic-font' ); } else { wp_register_style( 'runo-vollkorn-font', 'http://fonts.googleapis.com/css?family=Vollkorn:400,400italic'); // enqueing: wp_enqueue_style( 'runo-vollkorn-font' ); } } add_action('wp_enqueue_scripts', 'runo_theme_styles'); /** * Hook for Runo scripts */ function runo_scripts() { wp_enqueue_script( 'runo-script', get_template_directory_uri() . '/js/runo.js', array('jquery') ); } add_action('wp_enqueue_scripts', 'runo_scripts'); /** * Comments threading */ if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); /** * Enable more buttons in TinyMCE editor */ function runo_enable_more_buttons($buttons) { $buttons[] = 'fontselect'; $buttons[] = 'fontsizeselect'; $buttons[] = 'backcolor'; $buttons[] = 'anchor'; $buttons[] = 'hr'; $buttons[] = 'wp_page'; $buttons[] = 'cleanup'; return $buttons; } add_filter("mce_buttons_3", "runo_enable_more_buttons"); /** * Sets the post excerpt length to 40 words. * */ function runo_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'runo_excerpt_length' ); /** * Returns a "Continue Reading" link for excerpts */ function runo_continue_reading_link() { return ' ' . __( 'Continue reading ', 'runo' ) . ''; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and runo_continue_reading_link(). * */ function runo_auto_excerpt_more( $more ) { return ' …' . runo_continue_reading_link(); } add_filter( 'excerpt_more', 'runo_auto_excerpt_more' ); /** * Adds a pretty "Continue Reading" link to custom post excerpts. * * To override this link in a child theme, remove the filter and add your own * function tied to the get_the_excerpt filter hook. */ function runo_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= runo_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'runo_custom_excerpt_more' ); /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. */ function runo_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'runo_page_menu_args' ); /** * Register our sidebars and widgetized areas. * */ function runo_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'runo' ), 'id' => 'sidebar-1', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Area One', 'runo' ), 'id' => 'sidebar-3', 'description' => __( 'An optional widget area for your site footer', 'runo' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Area Two', 'runo' ), 'id' => 'sidebar-4', 'description' => __( 'An optional widget area for your site footer', 'runo' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Area Three', 'runo' ), 'id' => 'sidebar-5', 'description' => __( 'An optional widget area for your site footer', 'runo' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'runo_widgets_init' ); if ( ! function_exists( 'runo_content_nav' ) ) : /** * Display navigation to next/previous pages when applicable */ function runo_content_nav( $nav_id ) { global $wp_query; if ( $wp_query->max_num_pages > 1 ) : ?> ]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) return false; return esc_url_raw( $matches[1] ); } /** * Count the number of footer sidebars to enable dynamic classes for the footer */ function runo_footer_sidebar_class() { $count = 0; if ( is_active_sidebar( 'sidebar-3' ) ) $count++; if ( is_active_sidebar( 'sidebar-4' ) ) $count++; if ( is_active_sidebar( 'sidebar-5' ) ) $count++; $class = ''; switch ( $count ) { case '1': $class = 'one'; break; case '2': $class = 'two'; break; case '3': $class = 'three'; break; } if ( $class ) echo 'class="' . $class . '"'; } if ( ! function_exists( 'runo_comment' ) ) : /** * Template for comments and pingbacks. * */ function runo_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : ?>
  • ', '' ); ?>

  • id="li-comment-">
    comment_parent ) $avatar_size = 39; echo get_avatar( $comment, $avatar_size ); /* translators: 1: comment author, 2: date and time */ printf( __( '%1$s on %2$s said:', 'runo' ), sprintf( '%s', get_comment_author_link() ), sprintf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), /* translators: 1: date, 2: time */ sprintf( __( '%1$s at %2$s', 'runo' ), get_comment_date(), get_comment_time() ) ) ); ?> ', '' ); ?>
    comment_approved == '0' ) : ?>
    __( 'Reply ', 'runo' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    footnotes[$id] ) ) $this->footnotes[$id] = array( 0 => false ); $this->footnotes[$id][] = $content; $note = count( $this->footnotes[$id] ) - 1; return ' ' . $note . ''; } function the_content( $content ) { if ( ! $GLOBALS['multipage'] ) return $this->footnotes( $content ); return $content; } function wp_link_pages_args( $args ) { // if wp_link_pages appears both before and after the content, // $this->footnotes[$id] will be empty the first time through, // so it works, simple as that. $args['after'] = $this->footnotes( $args['after'] ); return $args; } function footnotes( $content ) { global $id; if ( empty( $this->footnotes[$id] ) ) return $content; $content .= '

    '. __( 'Notes:', 'runo' ) .'

      '; foreach ( array_filter( $this->footnotes[$id] ) as $num => $note ) $content .= '
    1. ' . do_shortcode( $note ) . '
    2. '; $content .= '
    '; return $content; } } new runo_footnotes(); // Add more-class to posts which contain more shortcode function runo_add_more_to_post_class( $classes ) { global $post; if ( ( is_archive() || is_home() ) && false !== strpos( $post->post_content, '' ) && ! in_array( 'more', $classes ) ) { $classes[] = 'more'; } return $classes; } add_filter( 'post_class', 'runo_add_more_to_post_class' ); /** * Where the post has no post title, but must still display a link to the single-page post view. */ add_filter('the_title', 'runo_title'); function runo_title($title) { if ($title == '') { return _e( 'Untitled', 'runo' ) ; } else { return $title; } }