Guest User

Untitled

a guest
Jun 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. function onepress_before_section( $section_id, $args = array() ){
  2. if ( ! isset( $args['_bg_type'] ) ) {
  3. $args['_bg_type'] = '';
  4. }
  5.  
  6. if ( ! class_exists( 'OnePress_Plus' ) ) {
  7. if ( $section_id == 'videolightbox' ) {
  8. $image = onepress_get_video_lightbox_image();
  9. if ( $image || onepress_is_selective_refresh() ) {
  10. echo '<div class="section-parallax">';
  11. echo ' <div class="parallax-bg"><img src="' . esc_url($image) . '" alt=""></div>';
  12. }
  13. return ;
  14. }
  15. }
  16.  
  17. switch( $args['_bg_type'] ) {
  18. case 'video':
  19. $args = wp_parse_args( $args, array(
  20. 'video_url' => '',
  21. 'video_webm_url' => '',
  22. 'video_ogv_url' => '',
  23. 'image' => ''
  24. ) );
  25. extract( $args );
  26. if ( $video_url || $video_webm_url || $video_ogv_url ) {
  27. ?>
  28. <div class="video-section"
  29. data-mp4="<?php echo esc_url( $video_url ); ?>"
  30. data-webm="<?php echo esc_url( $video_webm_url ); ?>"
  31. data-ogv="<?php echo esc_url( $video_ogv_url ); ?>"
  32. data-bg="<?php echo esc_attr( $image ); ?>">
  33. <?php
  34. }
  35. break;
  36.  
  37. case 'image':
  38. $args = wp_parse_args( $args, array(
  39. 'image' => '',
  40. 'alpha' => '',
  41. 'enable_parallax' => ''
  42. ) );
  43. extract( $args );
  44. if ( $enable_parallax == 1 ) {
  45. $class = 'section-parallax';
  46. if( $section_id == 'hero' ){
  47. $class =' parallax-hero';
  48. }
  49. echo '<div id="parallax-'.esc_attr( $section_id ).'" class="'.esc_attr( $class ).'">';
  50. echo ' <div class="parallax-bg"><img src="'.esc_url( $image ).'" alt=""></div>';
  51. } else if ( $image || $alpha ) { // image bg
  52. echo '<div id="bgimage-'.esc_attr( $section_id ).'" class="bgimage-alpha bgimage-'.esc_attr( $section_id ).'">';
  53. }
  54. break;
  55. }// end switch
  56. }
Add Comment
Please, Sign In to add comment