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 | |
/** | |
* Remove link from post title in member media page and group media page. | |
*/ | |
function rtm_change_post_title_member_group_cb( $template, $new_rt_template ) { | |
global $wp_query, $post; | |
if ( ( 'bp_member' === $post->post_type || 'bp_group' === $post->post_type ) ) { | |
preg_match( '~>\K[^<>]*(?=<)~', $post->post_title, $matches ); | |
if ( ! empty( $matches ) ) { |
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 | |
/** | |
* Change query var to fetch albums from database. | |
* | |
* @param array $query_vars Query vars. | |
* @return array Modified query vars. | |
*/ | |
function rtm_change_query_var_cb( $query_vars ) { | |
global $wp_query; | |
if ( isset( $wp_query->query_vars['media'] ) && '' === $wp_query->query_vars['media'] ) { |
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 | |
/** | |
* Display album name with permalink. | |
* | |
* @param $media_id Current media id for which we need to display the album link. | |
*/ | |
function tmp_rtm_display_album_link( $media_id ) { | |
global $rt_ajax_request; |
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 | |
/** | |
* This code snippet enhances the sort functionality provided by rtMedia Sorting plugin by providing sorting using | |
* custom attributes that is created by rtMedia Custom Attributes plugin. | |
* Both rtMedia Custom Attributes and rtMedia Sorting plugins must be enabled for this code snippet to work. | |
*/ | |
// Enter attribute slug here. | |
$rtm_attributes_slug = 'camera'; |
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 | |
/** | |
* Allow only pdf documents on upload. | |
* | |
* Only allow documents which has pdf extension. | |
* | |
* @param array $allowed_types Allowed types of media to upload. | |
* | |
* @return array Allowed types of media to upload |
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 | |
/** | |
* 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 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 | |
if ( ! function_exists( 'rtmedia_change_order_by_asc_callback' ) ) { | |
/** | |
* Change order of media from descending to ascending. | |
* | |
* This function changes the order by query string when | |
* media is uploaded from byssypress activity page or from uploader widget. | |
* | |
* @param string $qorderby order by query string | |
* |