Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
leebaz
ParticipantThank you - appears to be working now!
leebaz
ParticipantHi, thanks for your reply. I've moved the plug-ins and activated them as you said.
Here is the full meta-box registering code:<?php /********************* META BOX DEFINITIONS ***********************/ /** * Prefix of meta keys (optional) * Use underscore (_) at the beginning to make keys hidden * Alt.: You also can make prefix empty to disable it */ // Better has an underscore as last sign $prefix = 'rw_'; global $meta_boxes; $meta_boxes = array(); //Home page slider inclusion////////////////////////////////////////////////////////////////////////////////// $meta_boxes[] = array( // Meta box id, UNIQUE per meta box. Optional since 4.1.5 'id' => 'home-page-content', // Meta box title - Will appear at the drag and drop handle bar. Required. 'title' => __( 'Conent for the Home Page', 'rwmb' ), // Post types, accept custom post types as well - DEFAULT is array('post'). Optional. 'pages' => array( 'page' ), // Where the meta box appear: normal (default), advanced, side. Optional. 'context' => 'normal', // Order of meta box: high (default), low. Optional. 'priority' => 'high', // Auto save: true, false (default). Optional. 'autosave' => true, // List of meta fields 'fields' => array( // TEXT BOX ONE array( // Field name - Will be used as label 'name' => __( '1st Info Box Title', 'rwmb' ), 'id' => "{$prefix}1st_box_title", 'desc' => __( 'Enter the title for the first info box', 'rwmb' ), 'type' => 'text', 'std' => __( 'e.g what we do', 'rwmb' ), 'clone' => false, ), // TEXTAREA array( 'name' => __( '1st Info Box text content', 'rwmb' ), 'desc' => __( 'Text content for the first info box', 'rwmb' ), 'id' => "{$prefix}1st_box_content", 'type' => 'textarea', 'cols' => 20, 'rows' => 3, ), // TEXT BOX TWO array( // Field name - Will be used as label 'name' => __( '2nd Info Box Title', 'rwmb' ), 'id' => "{$prefix}2nd_box_title", 'desc' => __( 'Enter the title for the second info box', 'rwmb' ), 'type' => 'text', 'std' => __( 'e.g what we do', 'rwmb' ), 'clone' => false, ), // TEXTAREA array( 'name' => __( '2nd Info Box text content', 'rwmb' ), 'desc' => __( 'Text content for the second info box', 'rwmb' ), 'id' => "{$prefix}2nd_box_content", 'type' => 'textarea', 'cols' => 20, 'rows' => 3, ), // RADIO BUTTONS array( 'name' => __( 'Video or Image', 'rwmb' ), 'id' => "{$prefix}vid_img", 'type' => 'radio', // Array of 'value' => 'Label' pairs for radio options. // Note: the 'value' is stored in meta field, not the 'Label' 'options' => array( 'usevid' => __( 'Video', 'rwmb' ), 'useimg' => __( 'Image', 'rwmb' ), ), ), // URL array( 'name' => __( 'Video URL', 'rwmb' ), 'id' => "{$prefix}vid_url", 'desc' => __( 'Paste the YouTube EMBED URL here', 'rwmb' ), 'type' => 'url', 'std' => 'http://youtube.com/', ), // IMAGE ADVANCED (WP 3.5+) array( 'name' => __( 'Video Replacement Image', 'rwmb' ), 'id' => "{$prefix}vid_repl_img", 'type' => 'image_advanced', 'max_file_uploads' => 1, 'desc' =>'Upload images for the home page ad next to the video 900px by 510px', ), // IMAGE ADVANCED (WP 3.5+) array( 'name' => __( 'Video image advertisement', 'rwmb' ), 'id' => "{$prefix}advert", 'type' => 'image_advanced', 'max_file_uploads' => 1, 'desc' =>'Upload images for the home page ad next to the video 720px by 200px', ), // URL array( 'name' => __( 'Ad URL', 'rwmb' ), 'id' => "{$prefix}ad_url", 'desc' => __( 'Paste the URL where you want the ad to link to here', 'rwmb' ), 'type' => 'url', 'std' => '', ), // 1st tag line array( // Field name - Will be used as label 'name' => __( '1st Tag Line', 'rwmb' ), 'id' => "{$prefix}1st_tag_line", 'desc' => __( 'Enter the 1st tag line here', 'rwmb' ), 'type' => 'text', 'std' => __( 'e.g across the planet', 'rwmb' ), 'clone' => false, ), // 2nd tag line array( // Field name - Will be used as label 'name' => __( '2nd Tag Line', 'rwmb' ), 'id' => "{$prefix}2nd_tag_line", 'desc' => __( 'Enter the 2nd tag line here', 'rwmb' ), 'type' => 'text', 'std' => __( 'e.g across the planet', 'rwmb' ), 'clone' => false, ), // IMAGE ADVANCED (WP 3.5+) array( 'name' => __( 'Images', 'rwmb' ), 'id' => "{$prefix}slideimg", 'type' => 'image_advanced', 'max_file_uploads' => 3, 'desc' =>'Upload images for the page backgrounds 1440px by 875px', ), ), 'only_on' => array( //'id' => array( 1, 2 ), //'slug' => array( 'home' ), 'template' => array( 'template-landing.php' ), //'parent' => array( 10 ) ), ); $meta_boxes[] = array( // Meta box id, UNIQUE per meta box. Optional since 4.1.5 'id' => 'faq', // Meta box title - Will appear at the drag and drop handle bar. Required. 'title' => __( 'Product FAQs', 'rwmb' ), // Post types, accept custom post types as well - DEFAULT is array('post'). Optional. 'pages' => array( 'product' ), // Where the meta box appear: normal (default), advanced, side. Optional. 'context' => 'normal', // Order of meta box: high (default), low. Optional. 'priority' => 'low', // Auto save: true, false (default). Optional. 'autosave' => true, // List of meta fields 'fields' => array( // Group array( 'name' => 'Group', // Optional 'id' => 'group_id', 'type' => 'group', // Group type 'clone' => true, // Can be cloned? // TEXTAREA array( 'name' => __( 'FAQ', 'rwmb' ), 'desc' => __( 'Add the FAQ here', 'rwmb' ), 'id' => "{$prefix}faq", 'type' => 'textarea', 'cols' => 20, 'rows' => 3, 'clone' => true, ), ) ), ); /********************* Add more meta boxes below ***********************/ /********************* META BOX REGISTERING ***********************/ /** * Register meta boxes * * @return void */ function rw_register_meta_boxes() { global $meta_boxes; // Make sure there's no errors when the plugin is deactivated or during upgrade if ( class_exists( 'RW_Meta_Box' ) ) { foreach ( $meta_boxes as $meta_box ) { if ( isset( $meta_box['only_on'] ) && ! rw_maybe_include( $meta_box['only_on'] ) ) { continue; } new RW_Meta_Box( $meta_box ); } } } add_action( 'admin_init', 'rw_register_meta_boxes' ); /** * Check if meta boxes is included * * @return bool */ function rw_maybe_include( $conditions ) { // Include in back-end only if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN ) { return false; } // Always include for ajax if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { return true; } if ( isset( $_GET['post'] ) ) { $post_id = $_GET['post']; } elseif ( isset( $_POST['post_ID'] ) ) { $post_id = $_POST['post_ID']; } else { $post_id = false; } $post_id = (int) $post_id; $post = get_post( $post_id ); foreach ( $conditions as $cond => $v ) { // Catch non-arrays too if ( ! is_array( $v ) ) { $v = array( $v ); } switch ( $cond ) { case 'id': if ( in_array( $post_id, $v ) ) { return true; } break; case 'parent': $post_parent = $post->post_parent; if ( in_array( $post_parent, $v ) ) { return true; } break; case 'slug': $post_slug = (!empty( $post->post_name)); if ( in_array( $post_slug, $v ) ) { return true; } break; case 'template': $template = get_post_meta( $post_id, '_wp_page_template', true ); if ( in_array( $template, $v ) ) { return true; } break; } } // If no condition matched return false; }but I'm still getting the following error message in the editor:
Notice: Undefined index: fields in /Users/Lee/Sites/akita/wp-content/plugins/meta-box-group/group.php on line 43
Warning: Invalid argument supplied for foreach() in /Users/Lee/Sites/akita/wp-content/plugins/meta-box-group/group.php on line 43
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)