Skip to content

Instantly share code, notes, and snippets.

View pranali333's full-sized avatar
👻
Observing...

Pranali Patel pranali333

👻
Observing...
View GitHub Profile
@pranali333
pranali333 / functions.php
Created March 8, 2017 13:55
custom code to remove the action( which is not declared static ) from the class.
<?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
@pranali333
pranali333 / functions.php
Created March 1, 2017 13:42
Custom code to keep rtMedia default sorting option in the same line with other rtMedia sort parameters under shortcode
/**
* 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.
@pranali333
pranali333 / custom_style.css
Last active February 28, 2017 06:46
Custom CSS to stretch the media uploaded by rtMedia horizontally to have full mobile device width
//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;
}
@pranali333
pranali333 / functions.php
Last active February 21, 2017 09:17
Customize album gallery template to display album description
<?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();
}
@pranali333
pranali333 / functions.php
Created February 15, 2017 07:07
rtMedia gallery shortcode to list media from all albums by excluding the specific ones.
<?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 );
/**
@pranali333
pranali333 / functions.php
Last active March 6, 2017 13:44
Restrict rtMedia uploader view for author of the custom post.
<?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;
@pranali333
pranali333 / functions.php
Created January 31, 2017 13:33
Remove action bp_activity_entry_meta from RTMediaPrivacy class under rtMedia
<?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
@pranali333
pranali333 / album-gallery-item.php
Created January 30, 2017 13:57
Hide the Wall Posts album from album gallery
@pranali333
pranali333 / functions.php
Last active March 14, 2017 06:59
Custom code to keep media description open while uploading media using rtMedia uploader
// 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($) {
@pranali333
pranali333 / functions.php
Created January 16, 2017 14:28
Fetching google plus count directly from google API for rtSocial plugin
<?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. */