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
<?php | |
/** | |
* Remove Class Filter Without Access to Class Object | |
* | |
* In order to use the core WordPress remove_filter() on a filter added with the callback | |
* to a class, you either have to have access to that class object, or it has to be a call | |
* to a static method. This method allows you to remove filters with a callback to a class | |
* you don't have access to. | |
* | |
* @param string $tag Filter to remove |
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
/** | |
* This snippet is used to align rtMedia default sorting option with other rtMedia sort parameters | |
* under rtMedia shortcode. | |
* You can try using this code under your theme's functions.php file. | |
*/ | |
if ( ! function_exists( 'rtmedia_wp_head_fix_sorting_button' ) ) { | |
function rtmedia_wp_head_fix_sorting_button() { | |
// Check if the constant RTMEDIA_SORTING_VERSION exists. | |
if ( defined( 'RTMEDIA_SORTING_VERSION' ) ) { | |
// check if the RTMEDIA_SORTING_VERSION constant version is less then 1.1.6. |
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
//You need to add following CSS in rtMedia admin > Settings > Custom CSS | |
@media ( max-width: 500px ) { | |
li.rtmedia-list-item.media-type-photo { | |
width: 100%; | |
} | |
li.rtmedia-list-item.media-type-photo a { | |
display: block; | |
} |
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
<?php | |
// Fetch album description | |
function custom_rtmedia_get_album_desc(){ | |
global $rtmedia_backbone; | |
if ( $rtmedia_backbone[ 'backbone' ] ){ | |
echo '<%= album_desc %>'; | |
} else { | |
return rtmedia_get_album_desc_custom(); | |
} |
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
<?php | |
/** | |
* Magic begins from here | |
*/ | |
function my_rtmedia_set_query_filters() { | |
add_filter( 'rtmedia_media_query', 'my_modify_media_query', 9, 3 ); | |
} | |
add_action( 'rtmedia_set_query', 'my_rtmedia_set_query_filters', 99 ); | |
/** |
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
<?php | |
//Function to restrict rtmedia uploader view for author | |
function restrict_rtmedia_uploader( $allow, $section ) { | |
// Add Your Post Type Here | |
$ctp = ''; | |
if ( $ctp == get_post()->post_type ) { | |
if ( get_post()->post_author == get_current_user_id() ) { | |
$allow = true; |
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
<?php | |
/** | |
* Remove Class Filter Without Access to Class Object | |
* | |
* In order to use the core WordPress remove_filter() on a filter added with the callback | |
* to a class, you either have to have access to that class object, or it has to be a call | |
* to a static method. This method allows you to remove filters with a callback to a class | |
* you don't have access to. | |
* | |
* @param string $tag Filter to remove |
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
<?php | |
/** That's all, stop editing from here * */ | |
global $rtmedia_backbone; | |
$rtmedia_backbone = array( | |
'backbone' => false, | |
'is_album' => false, | |
'is_edit_allowed' => false, | |
); |
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
// Check if function does not exist. | |
if ( ! function_exists( 'rtmedia_wp_footer_open_title_and_desc_callback' ) ) { | |
/** | |
* Add script in the wp_footer that fire just after the media is added in the rtMedia up-loader | |
* By default it will open the title and description box of the media | |
*/ | |
function rtmedia_wp_footer_open_title_and_desc_callback() { | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { |
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
<?php | |
/** | |
* Fetch google plus count from google API. | |
*/ | |
function rtmedia_wp_footer_callback(){ | |
/* Check if user is logged-in. */ | |
if( ! is_user_logged_in() ){ | |
/* Get option settings of the rtSocial plugin. */ |