Created
June 19, 2020 14:44
-
-
Save farookibrahim/18c47937c31849e4323dbc7d3ed75e0e to your computer and use it in GitHub Desktop.
Vodi - Movie v6 Casts(Stars) section include Crew
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
| if ( ! function_exists( 'vodi_template_single_movie_casts' ) ) { | |
| function vodi_template_single_movie_casts() { | |
| global $movie; | |
| $casts = $movie->get_cast(); | |
| $crews = $movie->get_crew(); | |
| if( ! empty( $casts ) || ! empty( $crews ) ) { | |
| $title = apply_filters( 'vodi_template_single_movie_casts_title', esc_html__( 'Stars', 'vodi' ), $movie, $casts ); | |
| $carousel_args = apply_filters( 'vodi_template_single_movie_casts_carousel_args', array( | |
| 'slidesToShow' => 6, | |
| 'slidesToScroll' => 2, | |
| 'dots' => false, | |
| 'arrows' => false, | |
| 'autoplay' => false, | |
| 'infinite' => false, | |
| 'responsive' => array( | |
| array( | |
| 'breakpoint' => 768, | |
| 'settings' => array( | |
| 'slidesToShow' => 2, | |
| 'slidesToScroll' => 1 | |
| ) | |
| ), | |
| array( | |
| 'breakpoint' => 992, | |
| 'settings' => array( | |
| 'slidesToShow' => 3, | |
| 'slidesToScroll' => 1 | |
| ) | |
| ), | |
| array( | |
| 'breakpoint' => 1200, | |
| 'settings' => array( | |
| 'slidesToShow' => 4, | |
| 'slidesToScroll' => 1 | |
| ) | |
| ), | |
| ), | |
| ) ); | |
| $section_id = 'section-movies-carousel-casts-' . uniqid(); | |
| ?> | |
| <section id="<?php echo esc_attr( $section_id ); ?>" class="single-movie-casts"> | |
| <?php echo sprintf( '<h2 class="single-movie-casts--title">%s</h2>', $title ); ?> | |
| <div class="movie-casts" data-ride="vodi-slick-carousel" data-wrap=".movie-casts__inner" data-slick="<?php echo htmlspecialchars( json_encode( $carousel_args ), ENT_QUOTES, 'UTF-8' ); ?>"> | |
| <div class="movie-casts__inner"> | |
| <?php | |
| if( ! empty( $casts ) ) { | |
| foreach( $casts as $cast ) : | |
| $person = masvideos_get_person( $cast['id'] ); | |
| if( $person && is_a( $person, 'MasVideos_Person' ) ) : | |
| ?> | |
| <div class="movie-cast"> | |
| <div class="person-image"> | |
| <a href="<?php the_permalink( $person->get_ID() ); ?>"> | |
| <?php echo masvideos_get_person_thumbnail( 'masvideos_movie_thumbnail', $person ); ?> | |
| </a> | |
| </div> | |
| <a href="<?php the_permalink( $person->get_ID() ); ?>"> | |
| <h3 class="person-name"><?php echo esc_html( $person->get_name() ); ?></h3> | |
| </a> | |
| <div class="person-role"><?php echo esc_html( $cast['character'] ); ?></div> | |
| </div> | |
| <?php | |
| endif; | |
| endforeach; | |
| } | |
| if( ! empty( $crews ) ) { | |
| foreach( $crews as $crew ) : | |
| $person = masvideos_get_person( $crew['id'] ); | |
| if( $person && is_a( $person, 'MasVideos_Person' ) ) : | |
| ?> | |
| <div class="movie-cast"> | |
| <div class="person-image"> | |
| <a href="<?php the_permalink( $person->get_ID() ); ?>"> | |
| <?php echo masvideos_get_person_thumbnail( 'masvideos_movie_thumbnail', $person ); ?> | |
| </a> | |
| </div> | |
| <a href="<?php the_permalink( $person->get_ID() ); ?>"> | |
| <h3 class="person-name"><?php echo esc_html( $person->get_name() ); ?></h3> | |
| </a> | |
| <div class="person-role"><?php echo esc_html( $crew['job'] ); ?></div> | |
| </div> | |
| <?php | |
| endif; | |
| endforeach; | |
| } | |
| ?> | |
| </div> | |
| </div> | |
| </section> | |
| <?php | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment