Last active
March 10, 2016 22:25
-
-
Save carasmo/0cb2014f9a3673a3908c to your computer and use it in GitHub Desktop.
Replace breadcrumb on single attachment post
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
<?php | |
// don't use | |
//this goes inside the functions.php file in your Genesis child theme. USE FTP and a code editor. | |
/** ==================================================================================== | |
Replace breadcrumb on single attachment post | |
==================================================================================== **/ | |
function themeprefix_replace_attachment_breadcrumb() { | |
if ( is_singular ( 'attachment' ) ) { | |
//remove genesis breadcrumb | |
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); | |
//vars | |
$title = get_the_title(); | |
$home = '<a href="' . get_site_url() . '">Home</a>'; | |
$parent = '<a href="' . get_site_url() . '/islamic-images/">Islamic Images</a>'; | |
//build new breadcrumb matching the original | |
$breadcrumb = '<div class="breadcrumb">'; | |
$breadcrumb.= 'You are here: '; | |
$breadcrumb.= ''. $home .' / '; | |
$breadcrumb.= ''. $parent .' / '; | |
$breadcrumb.= ''. $title .''; | |
$breadcrumb.= '</div>'; | |
echo $breadcrumb; | |
} | |
} | |
add_action( 'genesis_before_loop', 'themeprefix_replace_attachment_breadcrumb', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment