Created
February 21, 2017 11:07
-
-
Save cheh/07914fa20aba67080752e1bee192c2d4 to your computer and use it in GitHub Desktop.
Relocate Testimonials slider nav
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
/* hooks.php*/ | |
// Remove navigation for Testimonials slider. | |
add_filter( 'tm_testimonials_loop_after', '__tm_remove_testi_slider_nav', 1, 2 ); | |
function __tm_remove_testi_slider_nav( $inner, $args ) { | |
remove_filter( 'tm_testimonials_loop_after', array( 'TM_Testimonials_Hook', 'slider_navigation' ), 10 ); | |
return $inner; | |
} | |
// Add navigation for Testimonials slider. | |
add_filter( 'tm_testimonials_wrapper_format', '__tm_add_testi_slider_nav', 11, 2 ); | |
function __tm_add_testi_slider_nav( $format, $args ) { | |
if ( ! class_exists( 'TM_Testimonials_Hook' ) ) { | |
return $format; | |
} | |
if ( ! TM_Testimonials_Hook::is_slider( $args ) ) { | |
return $format; | |
} | |
if ( empty( $args['data_atts'] ) ) { | |
return $format; | |
} | |
$atts = wp_parse_args( array( 'id' => TM_Testimonials_Hook::$instance ), $args['data_atts'] ); | |
$data_atts = wp_json_encode( $atts ); | |
if ( false === $data_atts ) { | |
return $format; | |
} | |
$nav = TM_Testimonials_Hook::slider_navigation( '', $args ); | |
return "<div class='tm-testi'>%s<div id='tm-testi-slider-" . TM_Testimonials_Hook::$instance . "' class='%s' data-atts='" . $data_atts . "'>%s</div>" . $nav . "</div>"; | |
} | |
/* style.css*/ | |
.tm-testi { | |
position: relative; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment