0, 'sectionorder' => 0, 'label'=> 'Parallax Height', 'desc' => 'The height the parallax element should be in pixels. Set to 0 to auto set the height based on the post content. Minimum height is always 100px', 'id' => $prefix.'height', 'type' => 'number', 'min' => 0, 'max' => 2000 ), array( 'section' => 0, 'sectionorder' => 1, 'label'=> 'Parallax Image Size', 'desc' => 'The parallax image size will be scaled based on this value. Specify the width in pixels. Set to 0 to auto set the size of the image (recommended)', 'id' => $prefix.'pheight', 'type' => 'number', 'min' => 0, 'max' => 2000 ), array( 'section' => 0, 'sectionorder' => 2, 'label'=> 'Horizontal Position', 'desc' => 'The horizontal position of the header on the parallax background.', 'id' => $prefix.'hpos', 'type' => 'select', 'options' => array ( 'one' => array ( 'label' => 'Left', 'value' => 'left' ), 'two' => array ( 'label' => 'Centre', 'value' => 'center' ), 'three' => array ( 'label' => 'Right', 'value' => 'right' ) ) ), array( 'section' => 0, 'sectionorder' => 3, 'label'=> 'Vertical Position', 'desc' => 'The vertical position of the header on the parallax background. This setting is ignored if post content is specified.', 'id' => $prefix.'vpos', 'type' => 'select', 'options' => array ( 'one' => array ( 'label' => 'Top', 'value' => 'top' ), 'two' => array ( 'label' => 'Middle', 'value' => 'middle' ), 'three' => array ( 'label' => 'Bottom', 'value' => 'bottom' ) ) ), array( 'section' => 0, 'sectionorder' => 4, 'label'=> 'Header Style', 'desc' => 'Enter the inline CSS style required for the header eg. font-weight: bold; font-size: large;', 'id' => $prefix.'hstyle', 'type' => 'textarea', 'min' => 0, 'max' => 10000 ), array( 'section' => 0, 'sectionorder' => 5, 'label'=> 'Full Width', 'desc' => 'Display the parallax across the full width of the page. This is a work around to get a full width parallax if its not already. This may not work on some themes.', 'id' => $prefix.'FullWidth', 'type' => 'checkbox' ), array( 'section' => 1, 'sectionorder' => 0, 'label'=> 'Parallax Speed', 'desc' => 'The speed of the scrolling background. Value between 1 to 10. 10 being the quickest speed setting. Setting 0 will disable background scrolling', 'id' => $prefix.'speed', 'type' => 'number', 'min' => 0, 'max' => 10 ), array( 'section' => 1, 'sectionorder' => 1, 'label'=> 'Use Parallax.JS', 'desc' => 'Selecting this option will use parallax.js as the parallax engine. Select if the CSS parallax doesnt work as you require. Note that some of the other options may not work as desired with this setting', 'id' => $prefix.'parallaxjs', 'type' => 'checkbox' ), array( 'section' => 2, 'sectionorder' => 0, 'label'=> 'Mobile: Disable Parallax Image', 'desc' => 'Select this option if you would rather the background image not display at all on mobile devices.', 'id' => $prefix.'DisableParImg', 'type' => 'checkbox' ), array( 'section' => 2, 'sectionorder' => 1, 'label'=> 'Mobile: Disable Entire Parallax', 'desc' => 'Select this option if you would rather not display any of the parallax content when on mobile device.', 'id' => $prefix.'DisableParallax', 'type' => 'checkbox' ), array( 'section' => 2, 'sectionorder' => 2, 'label'=> 'Mobile: Image Size', 'desc' => 'Set a size here to scale the image size when on a mobile device. Specify the width in pixels. Set to 0 to auto set the size of the image.', 'id' => $prefix.'pheightmob', 'type' => 'number', 'min' => 0, 'max' => 2000 ) ); // The Callback function show_meta_parallax_scroll() { global $custom_meta_fields, $post; // Use nonce for verification echo ''; // Begin the field table and loop echo ''; //Display message first //echo ''; foreach ($custom_meta_fields as $field) { // get value of this field if it exists for this post $meta = esc_attr(get_post_meta($post->ID, $field['id'], true)); switch($field['section']){ case 0 : //Style if ($field['sectionorder']==0){ echo ''; parse_meta_parallax_scroll($field,$meta); }else{ parse_meta_parallax_scroll($field,$meta); } break; case 1 : //parallax options if ($field['sectionorder']==0){ echo ''; parse_meta_parallax_scroll($field,$meta); }else{ parse_meta_parallax_scroll($field,$meta); } break; case 2 : //mobile if ($field['sectionorder']==0){ echo ''; parse_meta_parallax_scroll($field,$meta); }else{ parse_meta_parallax_scroll($field,$meta); } break; } } // end foreach echo '
'; //echo '

'; //echo 'Parallax Scroll by adamrob.co.uk'; //echo '
Parallax scroll wil use the information in this post to build a parallax element on your site. This element can then be used in any page/post on your site by using a shortcode.'; //echo '

'; //echo '
'; //echo '
'; echo '

'; echo 'Style'; echo '
Using the following options to customise the style'; echo '

'; echo '

'; echo '

'; echo 'Parallax Settings'; echo '
Using the following options to customise how the parallax behaves'; echo '

'; echo '

'; echo '

'; echo 'Mobile Settings'; echo '
Using the following options to customise how the parallax behaves on a mobile device'; echo '

'; echo '
'; // end table } //Parse the HTML for the selected item function parse_meta_parallax_scroll($field, $meta){ echo ' '; switch($field['type']) { // Text field case 'text': echo '
'.$field['desc'].''; break; //Number field case 'number': echo '
'.$field['desc'].''; break; // textarea case 'textarea': echo '
'.$field['desc'].''; break; // checkbox case 'checkbox': echo ' '; break; // select case 'select': echo '
'.$field['desc'].''; break; } echo ''; } // Save the Data function save_meta_parallax_scroll($post_id) { global $custom_meta_fields; // verify nonce if (!wp_verify_nonce($_POST['parallax_scroll_meta_nonce'], basename(__FILE__))) return $post_id; // check autosave if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id; // check permissions if ('parallax_scroll' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) return $post_id; } elseif (!current_user_can('edit_post', $post_id)) { return $post_id; } // loop through fields and save the data foreach ($custom_meta_fields as $field) { $old = esc_attr(get_post_meta($post_id, $field['id'], true)); if (isset($_POST[$field['id']])){ $new = esc_attr($_POST[$field['id']]); }else{ $new = 0; } if (isset($new) && $new != $old) { update_post_meta($post_id, $field['id'], $new); } elseif ('' == $new && $old) { delete_post_meta($post_id, $field['id'], $old); } } // end foreach } add_action('save_post', 'save_meta_parallax_scroll'); ?>