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( '', $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 ){ ?>