' . __( 'Continue reading ', 'widely' ) . ''; } endif; // widely_continue_reading_link /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and widely_continue_reading_link(). * * To override this in a child theme, remove the filter and add your own * function tied to the excerpt_more filter hook. */ function widely_auto_excerpt_more( $more ) { return ' …' . widely_continue_reading_link(); } add_filter( 'excerpt_more', 'widely_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 widely_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= widely_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'widely_custom_excerpt_more' ); /** * Adds custom classes to the array of body classes. * * @param array $classes * @return array * * @since Widely 1.0 */ function widely_body_classes( $classes ) { $count = 0; if ( is_active_sidebar( 'sidebar-1' ) ) $count++; if ( is_active_sidebar( 'sidebar-2' ) ) $count++; if ( is_active_sidebar( 'sidebar-3' ) ) $count++; if ( is_active_sidebar( 'sidebar-4' ) ) $count++; $sidebar_classes = array( 'sidebars-none', 'sidebars-one', 'sidebars-two', 'sidebars-three', 'sidebars-four', ); $classes[] = $sidebar_classes[ $count ]; // Adds a class of group-blog to blogs with more than 1 published author if ( is_multi_author() ) { $classes[] = 'group-blog'; } return $classes; } add_filter( 'body_class', 'widely_body_classes' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages * * @param string $url * @param int $id * @return string * * @since Widely 1.0 */ function widely_enhanced_image_navigation( $url, $id ) { if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) return $url; $image = get_post( $id ); if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) $url .= '#main'; return $url; } add_filter( 'attachment_link', 'widely_enhanced_image_navigation', 10, 2 ); /** * Filters wp_title to print a neat tag based on what is being viewed. * * @param string $title * @param int $sep * @return string * * @since Widely 1.1 */ function widely_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'widely' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'widely_wp_title', 10, 2 ); /** * @todo */ function widely_social_icons() { $google_plus = get_theme_mod( 'google_plus', '' ); if ( ! empty( $google_plus ) ) : ?> <a href="<?php echo esc_url( $google_plus ); ?>" class="google-plus" title="<?php esc_attr_e( 'Google+', 'widely' ); ?>">g</a> <?php endif; $facebook = get_theme_mod( 'facebook', '' ); if ( ! empty( $facebook ) ) : ?> <a href="<?php echo esc_url( $facebook ); ?>" class="facebook" title="<?php esc_attr_e( 'Facebook', 'widely' ); ?>">z</a> <?php endif; $twitter = get_theme_mod( 'twitter', '' ); if ( ! empty( $twitter ) ) : ?> <a href="<?php echo esc_url( "http://twitter.com/$twitter" ); ?>" class="twitter" title="<?php esc_attr_e( 'Twitter', 'widely' ); ?>">@</a> <?php endif; $linkedin = get_theme_mod( 'linkedin', '' ); if ( ! empty( $linkedin ) ) : ?> <a href="<?php echo esc_url( $linkedin ); ?>" class="linkedin" title="<?php esc_attr_e( 'LinkedIn', 'widely' ); ?>">I</a> <?php endif; } //add_action( 'widely_credits', 'widely_social_icons' ); /** * Appends an infinity symbol as permalink to Aside posts * * @param string $content * @return string */ function widely_aside_infinity( $content ) { if ( has_post_format( 'aside' ) && ! is_singular() ) { $content .= sprintf( ' <a href="%1$s" title="%2$s" rel="bookmark">∞</a>', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to %s', 'widely' ), the_title_attribute( 'echo=0' ) ) ) ); } return $content; } add_filter( 'the_content', 'widely_aside_infinity', 0 ); // run before wpautop /** * Appends post title to Aside and Quote posts * * @param string $content * @return string */ function widely_conditional_title( $content ) { if ( ( has_post_format( 'aside' ) || has_post_format( 'quote' ) ) && is_singular() ) { $content .= the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>', false ); } return $content; } add_filter( 'the_content', 'widely_conditional_title', 0 );