Created
June 6, 2016 18:54
-
-
Save ArseniyShestakov/c3f29b2cfcbacd1b7ea63f138ad58006 to your computer and use it in GitHub Desktop.
Random ColorBox magic to show title on top of lightbox
This file contains hidden or 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
/* SXX */ | |
#cboxLoadedContent { | |
margin-top:28px; | |
} | |
#cboxTitle { | |
position:absolute; top:4px; left:0; text-align:center; width:100%; color:#444;font-weight:bold;text-decoration:underline; | |
} |
This file contains hidden or 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
/* SXX */ | |
function add_title_attachment_link($link, $id = null) { | |
$id = intval( $id ); | |
$_post = get_post( $id ); | |
$post_content = esc_attr( $_post->post_content ); | |
return str_replace('<a href', '<a title="'. $post_content .'" href', $link); | |
} | |
add_filter('wp_get_attachment_link', 'add_title_attachment_link', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment