Last active
May 17, 2017 09:04
-
-
Save BhargavBhandari90/b265e7d8c958a57760ae73d0162dc468 to your computer and use it in GitHub Desktop.
Remove link of url preview from activity
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 | |
// Add this function to theme's functions.php | |
// Check if function doest not exists. | |
if ( ! function_exists( 'rtmedia_wp_footer_add_js_remove_link' ) ) { | |
/** | |
* Remove link from activity url preview content. | |
*/ | |
function rtmedia_wp_footer_add_js_remove_link() { | |
?> | |
<script type="text/javascript"> | |
jQuery( function($) { | |
function remove_site_url() { | |
jQuery( '.rtmp_link_preview_container' ).each(function(e) { | |
var previewurl = jQuery(this).children('a').attr('href'); | |
jQuery(this).parent('.rtmp_final_link').siblings('p').find('a').each(function(e) { | |
var otherurl = jQuery(this).attr('href'); | |
if ( previewurl==otherurl ){ | |
jQuery(this).hide(); | |
} | |
jQuery( '.activity-inner' ).show(); | |
}); | |
}); | |
} | |
remove_site_url(); | |
// Remove target blank when new elements are added | |
jQuery( '#activity-stream' ).bind( "DOMSubtreeModified", function() { | |
remove_site_url(); | |
}); | |
}); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_footer', 'rtmedia_wp_footer_add_js_remove_link' ); | |
?> | |
// Add this to custom css ( rtMedia->settings->Custom CSS ) | |
#activity-stream .activity-inner { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment