Last active
May 17, 2018 14:46
-
-
Save natenault/af861546ab8a3468d12a09e89437ed54 to your computer and use it in GitHub Desktop.
Return anchor link for a single crumb in Genesis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return anchor link for a single breadcrumb. | |
* | |
* @param string $url URL for href attribute. | |
* @param string $content Linked content. | |
* @param bool|string $sep Optional. Separator. Default is empty string. | |
* | |
* @return string HTML markup for anchor link and optional separator. | |
*/ | |
function nn_get_breadcrumb_link( $url, $content, $sep = '' ) { | |
$itemprop_item = genesis_html5() ? ' itemprop="item"' : ''; | |
$itemprop_name = genesis_html5() ? ' itemprop="name"' : ''; | |
$link = sprintf( | |
'<a href="%s"%s><span%s>%s</span></a>', | |
esc_attr( $url ), | |
$itemprop_item, | |
$itemprop_name, | |
$content | |
); | |
if ( genesis_html5() ) { | |
$link = sprintf( | |
'<span %s>', | |
genesis_attr( 'breadcrumb-link-wrap' ) | |
) . $link . '</span>'; | |
} | |
if ( $sep ) { | |
$link .= $sep; | |
} | |
return $link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment