options = get_option( 'cyberchimps_options' ); add_action( 'wp_enqueue_scripts', array( $this, 'cyberchimps_parallax_scripts' ) ); add_action( 'wp_footer', array( $this, 'cyberchimps_parallax_render' ) ); add_filter( 'cyberchimps_field_filter', array( $this, 'cyberchimps_parallax_fields' ) ); // Set slider options $this->slider_parallax_toggle = ( isset( $this->options['cyberchimps_blog_slider_parallax'] ) ) ? $this->options['cyberchimps_blog_slider_parallax'] : 1; $this->slider_parallax_image = ( isset( $this->options['cyberchimps_blog_slider_parallax_image'] ) ) ? $this->options['cyberchimps_blog_slider_parallax_image'] : get_template_directory_uri() . '/images/parallax/sun.jpg'; // Set portfolio parallax options. $this->portfolio_parallax_toggle = ( isset( $this->options['cyberchimps_blog_portfolio_parallax'] ) ) ? $this->options['cyberchimps_blog_portfolio_parallax'] : 1; $this->portfolio_parallax_image = ( isset( $this->options['cyberchimps_blog_portfolio_parallax_image'] ) ) ? $this->options['cyberchimps_blog_portfolio_parallax_image'] : get_template_directory_uri() . '/images/parallax/trees.jpg'; // Get boxes parallax options. $this->boxes_parallax_toggle = ( isset( $this->options['cyberchimps_blog_boxes_parallax'] ) ) ? $this->options['cyberchimps_blog_boxes_parallax'] : 1; $this->boxes_parallax_image = ( isset( $this->options['cyberchimps_blog_boxes_parallax_image'] ) ) ? $this->options['cyberchimps_blog_boxes_parallax_image'] : get_template_directory_uri() . '/images/parallax/rocks.jpg'; // Get boxes parallax options. $this->body_parallax_toggle = ( isset( $this->options['cyberchimps_body_parallax'] ) ) ? $this->options['cyberchimps_body_parallax'] : 1; } /** * Sets up scripts for parallax */ public function cyberchimps_parallax_scripts() { // Add parallax js library. wp_enqueue_script( 'parallax-js', get_template_directory_uri() . '/elements/lib/js/jquery.parallax.min.js', array( 'jquery' ) ); } /** * Adds option fields to blog options * * @param $original * * @return mixed */ public function cyberchimps_parallax_fields( $original ) { // Slider parallax toggle. $new_field[][2] = array( 'name' => __( 'Parallax', 'cyberchimps_elements' ), 'id' => 'cyberchimps_blog_slider_parallax', 'type' => 'toggle', 'std' => 1, 'section' => 'cyberchimps_blog_slider_lite_section', 'heading' => 'cyberchimps_blog_heading' ); // Slider parallax image. $new_field[][3] = array( 'name' => __( 'Background image for parallax', 'cyberchimps_elements' ), 'desc' => __( 'Enter URL or upload file', 'cyberchimps_elements' ), 'id' => 'cyberchimps_blog_slider_parallax_image', 'class' => 'cyberchimps_blog_slider_parallax_toggle', 'type' => 'upload', 'std' => get_template_directory_uri() . '/images/parallax/sun.jpg', 'section' => 'cyberchimps_blog_slider_lite_section', 'heading' => 'cyberchimps_blog_heading' ); // Portfolio parallax toggle. $new_field[][2] = array( 'name' => __( 'Parallax', 'cyberchimps_elements' ), 'id' => 'cyberchimps_blog_portfolio_parallax', 'type' => 'toggle', 'std' => 1, 'section' => 'cyberchimps_blog_portfolio_lite_section', 'heading' => 'cyberchimps_blog_heading' ); // Portfolio parallax image. $new_field[][3] = array( 'name' => __( 'Background image for parallax', 'cyberchimps_elements' ), 'desc' => __( 'Enter URL or upload file', 'cyberchimps_elements' ), 'id' => 'cyberchimps_blog_portfolio_parallax_image', 'class' => 'cyberchimps_blog_portfolio_parallax_toggle', 'type' => 'upload', 'std' => get_template_directory_uri() . '/images/parallax/trees.jpg', 'section' => 'cyberchimps_blog_portfolio_lite_section', 'heading' => 'cyberchimps_blog_heading' ); // Boxes parallax toggle. $new_field[][2] = array( 'name' => __( 'Parallax', 'cyberchimps_elements' ), 'id' => 'cyberchimps_blog_boxes_parallax', 'type' => 'toggle', 'std' => 1, 'section' => 'cyberchimps_blog_boxes_lite_section', 'heading' => 'cyberchimps_blog_heading' ); // Boxes parallax image. $new_field[][3] = array( 'name' => __( 'Background image for parallax', 'cyberchimps_elements' ), 'desc' => __( 'Enter URL or upload file', 'cyberchimps_elements' ), 'id' => 'cyberchimps_blog_boxes_parallax_image', 'class' => 'cyberchimps_blog_boxes_parallax_toggle', 'type' => 'upload', 'std' => get_template_directory_uri() . '/images/parallax/rocks.jpg', 'section' => 'cyberchimps_blog_boxes_lite_section', 'heading' => 'cyberchimps_blog_heading' ); // Body parallax toggle. $new_field[][1] = array( 'name' => __( 'Parallax', 'cyberchimps_elements' ), 'id' => 'cyberchimps_body_parallax', 'desc' => __( 'Set the background image at Appearance > Background to get parallax effect on whole body.', 'cyberchimps_elements' ), 'type' => 'toggle', 'std' => 1, 'section' => 'cyberchimps_custom_layout_section', 'heading' => 'cyberchimps_design_heading' ); $new_fields = cyberchimps_array_field_organizer( $original, $new_field ); return $new_fields; } // Set parallax to individual elements by checking toggle. public function cyberchimps_parallax_render() { ?>