Skip to content

Instantly share code, notes, and snippets.

@pranali333
Created March 1, 2017 13:42
Show Gist options
  • Save pranali333/0f5aa249a7f9250cba7eb640af6abaf8 to your computer and use it in GitHub Desktop.
Save pranali333/0f5aa249a7f9250cba7eb640af6abaf8 to your computer and use it in GitHub Desktop.
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.
if ( version_compare( RTMEDIA_SORTING_VERSION, '1.1.6', '<=' ) ) {
?>
<style type="text/css">
.rtmedia-container .rtmedia-sortable-parameters {
width: auto;
display: inline-block;
}
.rtp-main-wrapper #rtm-gallery-title-container #rtm-media-options {
padding-top: 0;
}
</style>
<?php
} else {
?>
<style type="text/css">
#rtm-gallery-title-container {
position: relative;
}
.rtp-html #rtm-gallery-title-container .rtm-gallery-title {
display: inline-block;
}
.rtp-main-wrapper #rtm-gallery-title-container #rtm-media-options {
margin-bottom: 0;
position: absolute;
right: 0;
padding-top: 0;
top: 100%;
}
</style>
<?php
}
}
}
}
add_action( 'wp_head', 'rtmedia_wp_head_fix_sorting_button' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment