$add_below,
'depth' => $depth,
'max_depth' => $args['max_depth'],
) ) ); ?>
';
}
add_action( 'comment_form_after_fields', 'bfastmag_after_comment_fields' );
/**
* Creates a closing div for a bootstrap row.
*
* @global int $comment_open_div
* @return type
*/
function bfastmag_after_comment_fields() {
global $comment_open_div;
if ( $comment_open_div == 0 ) {
return;
}
echo '';
}
/**
* Jetpack Compatibility File.
*
* Jetpack setup function.
*
* See: https://jetpack.me/support/infinite-scroll/
* See: https://jetpack.me/support/responsive-videos/
* @link https://jetpack.me/
*
* @package bfastmag
*/
function bfastmag_jetpack_setup() {
// Add theme support for Infinite Scroll.
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'render' => 'bfastmag_infinite_scroll_render',
'footer' => 'page',
) );
// Add theme support for Responsive Videos.
add_theme_support( 'jetpack-responsive-videos' );
} // end function bfastmag_jetpack_setup
add_action( 'after_setup_theme', 'bfastmag_jetpack_setup' );
/**
* Custom render function for Infinite Scroll.
*/
function bfastmag_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', get_post_format() );
}
}
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function bfastmag_body_classes( $classes ) {
// Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) {
$classes[] = 'group-blog';
}
if ( bfastmag_isprevdem() ) {
$classes[] = 'prevpac';
}
return $classes;
}
add_filter( 'body_class', 'bfastmag_body_classes' );
/**
* SVG icons related functions and filters
*
* @package WordPress
* @subpackage Bfastmag
* @since 1.0
*/
/**
* Add SVG definitions to the footer.
*/
function bfastmag_include_svg_icons() {
// Define SVG sprite file.
$svg_icons = get_parent_theme_file_path( '/assets/images/svg-icons.svg' );
// If it exists, include it.
if ( file_exists( $svg_icons ) ) {
require_once( $svg_icons );
}
}
add_action( 'wp_footer', 'bfastmag_include_svg_icons', 9999 );
/**
* Return SVG markup taken from TwentySeventeen.
*
* @param array $args {
* Parameters needed to display an SVG.
*
* @type string $icon Required SVG icon filename.
* @type string $title Optional SVG title.
* @type string $desc Optional SVG description.
* }
* @return string SVG markup.
*/
function bfastmag_get_svg( $args = array() ) {
// Make sure $args are an array.
if ( empty( $args ) ) {
return __( 'Please define default parameters in the form of an array.', 'bfastmag' );
}
// Define an icon.
if ( false === array_key_exists( 'icon', $args ) ) {
return __( 'Please define an SVG icon filename.', 'bfastmag' );
}
// Set defaults.
$defaults = array(
'icon' => '',
'title' => '',
'desc' => '',
'fallback' => false,
);
// Parse args.
$args = wp_parse_args( $args, $defaults );
// Set aria hidden.
$aria_hidden = ' aria-hidden="true"';
// Set ARIA.
$aria_labelledby = '';
/*
* bfastmag doesn't use the SVG title or description attributes; non-decorative icons are described with .screen-reader-text.
*
* However, child themes can use the title and description to add information to non-decorative SVG icons to improve accessibility.
*
* Example 1 with title: 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ) ) ); ?>
*
* Example 2 with title and description: 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ), 'desc' => __( 'This is the description', 'textdomain' ) ) ); ?>
*
* See https://www.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/.
*/
if ( $args['title'] ) {
$aria_hidden = '';
$unique_id = uniqid();
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"';
if ( $args['desc'] ) {
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . ' desc-' . $unique_id . '"';
}
}
// Begin SVG markup.
$svg = '