'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' ), array( '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( '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( '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' ) ); // 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)); // begin a table row with echo ''; } // 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 '

To use Parallax Scroll simply follow these steps:'; echo '
  1. Enter a post title. This will be the main title displayed over the parallax background.
  2. '; echo '
  3. Optionally add some content to your post. If no content is specified then only the post header will display.
  4. '; echo '
  5. Add a feature image to your post. This image will be your parallax background. Parallax Scroll will not work without a feature image.
  6. '; echo '
  7. Fill out the optional parameters below to further customise your parallax.
  8. '; echo '
  9. Find the parallax shortcode which is listed on the main Parallax Scroll listing page, and paste it into a page/post of your choosing
'; echo 'For further help or support, please visit www.adamrob.co.uk'; 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; } //end switch echo '
'; // end table } // 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)); $new = esc_attr($_POST[$field['id']]); 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'); ?>