Skip to content

Instantly share code, notes, and snippets.

@raftaar1191
Created March 1, 2017 13:21
Show Gist options
  • Save raftaar1191/88b2970cfa162c348819ccab3b656ee4 to your computer and use it in GitHub Desktop.
Save raftaar1191/88b2970cfa162c348819ccab3b656ee4 to your computer and use it in GitHub Desktop.
Gallery shortcode with sorting parameter to bring sorting option and menu in one lines CSS
<?php
/**
* This snippet is used to fix issue mentioned
* at https://rtmedia.io/ticket/506359/
*/
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