Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Remove title attribute from media page.
<?php
// Add this code to theme's functions.php
// Remove title attribute from media page.
// Check if function doest not exists.
if ( ! function_exists( 'rtmedia_wp_footer_remove_title' ) ) {
function rtmedia_wp_footer_remove_title() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
function remove_title() {
jQuery( '.rtmedia-container .rtmedia-list .rtmedia-list-item' ).each( function(){
// Gets the title attribute
var title = jQuery( this ).find( '.rtmedia-list-item-a' ).attr( 'title' );
if( title != 'undefined' ) {
// Make title attribute blank if found
jQuery( this ).find( '.rtmedia-list-item-a' ).attr( 'title', '' );
}
});
}
// Function for removing title attribute
remove_title();
// Remove title attribute when new elements are added
jQuery('.rtmedia-list').bind("DOMSubtreeModified",function(){
remove_title();
});
});
</script>
<?php
}
}
add_action( 'wp_footer', 'rtmedia_wp_footer_remove_title' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment