Created
September 30, 2016 07:57
-
-
Save phpbits/d00bb6966721019721a3ca3f94378214 to your computer and use it in GitHub Desktop.
Manage Focus WordPress Slider Display for Testimonials
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
| <?php | |
| //remove date meta display | |
| add_action( 'focuswp_before_slide', 'focuswp_before_custom', 40 ); | |
| function focuswp_before_custom( $params ){ | |
| if( $params['item']->post_type == 'testimonials' ){ | |
| remove_action( 'focuswp_content_meta', array( $params['this'], 'slide_meta' )); | |
| } | |
| } | |
| //remove title display on top of excerpt | |
| add_filter( 'focuswp_content_title', 'focuswp_content_title_custom', 1, 10 ); | |
| function focuswp_content_title_custom( $title, $item ){ | |
| if( $item->post_type == 'testimonials' ){ | |
| return ''; | |
| } | |
| return $title; | |
| } | |
| //move title display to the bottom | |
| add_action( 'focuswp_slide_footer', 'focuswp_content_title_after', 40 ); | |
| function focuswp_content_title_after( $params ){ | |
| if( $params['item']->post_type == 'testimonials' ){ | |
| echo '<h3 class="focuswp-title">'. $params['item']->post_title .'</h3>'; | |
| } | |
| } | |
| //change excerpt length | |
| add_filter( 'focuswp_excerpt_length', 'custom_focus_excerpt_length' ); | |
| function custom_focus_excerpt_length( $length ){ | |
| if( is_home() || is_front_page() ){ //change this if you want to display slider anywhere | |
| $length = 100; | |
| } | |
| return $length; | |
| } | |
| //display testimonials before genesis footer | |
| //only display on homepage | |
| add_action( 'genesis_before_footer', 'focuswp_genesis_testimonials', 5 ); | |
| function focuswp_genesis_testimonials(){ | |
| if( is_home() || is_front_page() ){ //change this if you want to display slider anywhere ?> | |
| <div class="testimonial-wrap"> | |
| <div class="wrap"> | |
| <span class="above-title">What Customers are Saying</span> | |
| <?php echo do_shortcode('[focus-slides posts_per_page="5" orderby="date" order="DESC" autoplay="true" pager="true" speed="400" timeout="5000" post_type="testimonials" origin="media-frame" title="" ]');?> | |
| </div> | |
| </div> | |
| <?php } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment