Site Name and URL Shortcode
Adds a [site_name] shortcode that outputs the site name as plain text or a linked anchor with link="yes".
PHPby SnipCraft
php
<?php
add_shortcode( 'site_name', 'scseed_site_name_shortcode' );
function scseed_site_name_shortcode( $atts ) {
$atts = shortcode_atts(
array( 'link' => 'no' ),
$atts,
'site_name'
);
$name = esc_html( get_bloginfo( 'name' ) );
if ( 'yes' === $atts['link'] ) {
return '<a href="' . esc_url( home_url( '/' ) ) . '">' . $name . '</a>';
}
return $name;
}#branding#content#shortcode#site#utility