tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function adirondack_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // 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 ) && ! is_404() ) { $title .= " $sep " . sprintf( __( 'Page %s', 'adirondack' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'adirondack_wp_title', 10, 2 ); /** * Sets the authordata global when viewing an author archive. * * This provides backwards compatibility with * http://core.trac.wordpress.org/changeset/25574 * * It removes the need to call the_post() and rewind_posts() in an author * template to print information about the author. * * @global WP_Query $wp_query WordPress Query object. * @return void */ function adirondack_setup_author() { global $wp_query; if ( $wp_query->is_author() && isset( $wp_query->post ) ) { $GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author ); } } add_action( 'wp', 'adirondack_setup_author' ); /** * Get the bare-minimum attributes for our SVG file, so we have some * control over our output. * * @return array Array of tags => properties that will be used in wp_kses. */ function adirondack_allowed_svg(){ $allowed_svg = array( 'svg' => array( 'viewbox' => true ), 'symbol' => array( 'viewbox' => true, 'id' => true, 'fill' => true ), 'title' => array(), 'polygon' => array( 'points' => true ), 'path' => array( 'd' => true ), ); return apply_filters( 'adirondack_allowed_svg', $allowed_svg ); } /** * Load the SVG file in the header, right after the tag. * To load your own icons in a child theme, you can remove this using * `remove_action( 'adirondack_load_svg', 'adirondack_load_svg' ); * and add your own SVG sprite using the `adirondack_load_svg` hook. */ function adirondack_load_svg() { ob_start(); include_once( get_template_directory() . '/images/sprite.svg' ); $svg = ob_get_clean(); $svg = wp_kses( $svg, adirondack_allowed_svg() ); printf( '
%s
', $svg ); } add_action( 'adirondack_load_svg', 'adirondack_load_svg' ); /** * Shrink excerpt length * @return int Number of words to display */ function adirondack_excerpt_length( $len ) { if ( is_search() ) { return 48; } elseif ( ( 'status' == get_post_format() ) ) { return 24; } return 12; } add_filter( 'excerpt_length', 'adirondack_excerpt_length', 999 ); function adirondack_excerpt_more( $more ) { return '…'; } add_filter('excerpt_more', 'adirondack_excerpt_more'); /** * Custom display for comments */ /** * Comment display callback, determine which display function should be used based on comment type. * Pingbacks/trackbacks have a short display, while comments get full meta and author gravatar. * * @param object $comment The comment object. * @param array $args An array of arguments. * @param int $depth Depth of comment. */ function adirondack_handle_comment( $comment, $args, $depth ){ if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) { adirondack_ping( $comment, $args, $depth ); } else { adirondack_comment( $comment, $args, $depth ); } } /** * Display a pingback/trackback. Only display the pinging post. * * @param object $comment The comment object. * @param array $args An array of arguments. * @param int $depth Depth of comment. */ function adirondack_ping( $comment, $args, $depth ){ ?>
  • id="comment-">
    comment_approved ) : ?>

  • id="comment-">
    comment_parent != '0' ) { $comment_author = sprintf( __( 'In reply to %2$s, %1$s said,', 'adirondack' ), get_comment_author_link(), get_comment_author( $comment->comment_parent ) ); } else { $comment_author = sprintf( __( '%1$s said,', 'adirondack' ), get_comment_author_link() ); } echo apply_filters( 'comment_text', '' . $comment_author . ' ' . get_comment_text(), $comment, $args ); ?>
    comment_approved ) : ?>