Skip to content

Instantly share code, notes, and snippets.

View BhargavBhandari90's full-sized avatar
🏠
Working from home

Bhargav(Bunty) BhargavBhandari90

🏠
Working from home
View GitHub Profile
@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active May 17, 2017 09:04
Remove link of url preview from activity
<?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">
@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active May 18, 2017 12:33
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() {
@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active May 19, 2017 12:50
Remove the random number from the transcoded filename
<?php
/**
* Add this function to theme's functions.php
* Remove the random number from the transcoded filename
*
* @param string $tempname Transcoded file's temporary name.
* @return string $tempname Updated filename.
*/
function rtmc_transcoded_temp_filename( $tempname ) {
if ( class_exists( 'RT_Transcoder_Admin' ) ) {
@BhargavBhandari90
BhargavBhandari90 / functions.php
Created May 26, 2017 14:24
Add currecnt languge slug of WPML to media url in activity stream.
<?php
/**
* Add this code snippet to theme's functions.php
*
* Add currecnt languge slug of WPML to media url in activity stream.
*
*/
if ( ! function_exists( 'rtmedia_wpml_activity_urls' ) ) {
function rtmedia_wpml_activity_urls( $permalink, $media, $id ) {
global $sitepress;
@BhargavBhandari90
BhargavBhandari90 / functions.php
Created August 16, 2017 11:08
Replace media ID with the media title in URL
<?php
// Add this code into theme's functions.php
function custom_get_rtmedia_permalink( $permalink, $media, $id ) {
$post = get_post( $media[0]->media_id );
$title = isset( $post->post_name ) ? $post->post_name : '';
if ( ! empty( $title ) ) {
$permalink = str_replace( '/' . $id , '/' . $title, $permalink );
}
@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active October 13, 2017 09:54
Show pics on buddyboss photo page. Photos will not show if BuddyBoss is used with rtMedia with "Privacy Settings" enabled. So add this snippet to theme's functions.php
<?php
/**
*
* Fix - Show pics on buddyboss photo page.
* Photos will not show if BuddyBoss is used with rtMedia with "Privacy Settings" enabled.
* So add this snippet to theme's functions.php
*
*/
function rtmc_show_pics_buddyboss() {
@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active October 23, 2017 08:01
Change srcset when rtAmazon-s3 plugin is active. Use at your own RISK.
<?php
/**
* Add this function into theme's functions.php
*
* This function will replace domain with amazon s3 bucket url for image's srcset.
*/
function rtawss3_wp_calculate_image_srcset_latin( $sources, $size_array, $image_src, $image_meta, $attachment_id ) {
if ( ! class_exists( 'RTAWSS3_Class' ) ) {
@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active December 29, 2017 09:44
Read comment below for how to use.
<?php
/**
* Get media of perticular topic or forum
*
* @param int $item_id Id of forum
* @return array Array of media ids associated with the forum
*/
function rtcamp_get_perticular_forum_media( $item_id ) {
@BhargavBhandari90
BhargavBhandari90 / functions.php
Last active February 3, 2020 12:15
Add links to BuddyPress navigation.
<?php
/**
* Add this function to theme's functions.php
*
* Add links to BuddyPress navigation.
* This will add photo, video and music link to BuddyPress navigation.
*
* If you don't want to display "Media" tab, then add following css to
* rtMedia->Settings->Custom CSS:
*
@BhargavBhandari90
BhargavBhandari90 / .htaccess
Created June 7, 2018 05:20
Add these two line at the starting of WP rules
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L]