'h1',
'class' => 'site-title',
]
);
$html = '';
$title = get_bloginfo( 'name', 'display' );
if ( $title ) {
$link = home_link(
[
'text' => $title,
'class' => $args['class'],
]
);
$html = printf(
'<%1$s class="%2$s">%3$s',
tag_escape( $args['tags'] ),
esc_attr( $args['class'] ),
$link // phpcs:ignore
);
}
return apply_filters( 'backdrop_site_title', $html );
} elseif ( 'site-description' === $args ) {
$args = wp_parse_args(
$args,
[
'tag' => 'h3',
'class' => 'site-description',
]
);
$html = '';
$description = get_bloginfo( 'description' );
if ( $description ) {
$html = printf(
'<%1$s class="%2$s">%3$s%1$s>',
tag_escape( $args['tag'] ),
esc_attr( $args['class'] ),
$description // phpcs:ignore
);
}
return apply_filters( 'backdrop_site_description', $html );
}
}
/**
* Renders display
*
* @since 1.0.0
* @access public
* @param string $args output site information.
*/
public static function render( $args = '' ) {
if ( 'site-link' === $args ) {
$args = wp_parse_args(
$args,
[
'text' => '%s',
'class' => 'site-link',
'before' => '',
'after' => '',
]
);
$html = sprintf(
'%3$s',
esc_attr( $args['class'] ),
esc_url( home_url( '/' ) ),
sprintf( $args['text'], get_bloginfo( 'name' ) )
);
return apply_filters( 'backdrop_site_link', $html );
} elseif ( 'wp-link' === $args ) {
$args = wp_parse_args(
$args,
[
'text' => '%s',
'class' => 'wp-link',
'before' => '',
'after' => '',
]
);
$html = sprintf(
'%3$s',
esc_attr( $args['class'] ),
esc_url( __( 'https://wordpress.org', 'backdrop-core' ) ),
sprintf( $args['text'], esc_html__( 'WordPress', 'backdrop-core' ) )
);
return apply_filters( 'backdrop_wp_link', $html );
} elseif ( 'theme-link' === $args ) {
$theme_name = wp_get_theme( get_template() );
$allowed = array(
'abbr' => array( 'title' => true ),
'acronym' => array( 'title' => true ),
'code' => true,
'em' => true,
'strong' => true,
);
return sprintf( '%s', $theme_name->display( 'ThemeURI' ), wp_kses( $theme_name->display( 'Name' ), $allowed ) );
}
}
}
/**
* Renders home_link();
*
* @since 1.0.0
* @param array $args outputs home_link for site title.
*/
function home_link( array $args = [] ) {
$args = wp_parse_args(
$args,
[
'text' => '%s',
'before' => '',
'after' => '',
]
);
$html = sprintf(
'%2$s',
esc_url( home_url( '/' ) ),
sprintf( $args['text'], get_bloginfo( 'name' ) )
);
return apply_filters(
'backdrop_home_link',
$args['before'] . $html . $args['after']
);
}