/** * woothemes_metabox_create() * * Create the markup for the meta box. * * @access public * @param object $post * @param array $callback * @return void */ function woothemes_metabox_create($post, $callback) { _deprecated_function('woothemes_metabox_create', '6.0.0', __('an instance of the WF_Fields_Meta class', 'woothemes')); global $post; // Allow child themes/plugins to act here. do_action('woothemes_metabox_create', $post, $callback); $template_to_show = $callback['args']; $woo_metaboxes = get_option('woo_custom_template', array()); // Array sanity check. if (!is_array($woo_metaboxes)) { $woo_metaboxes = array(); } // Determine whether or not to display general fields. $display_general_fields = true; if (count($woo_metaboxes) <= 0) { $display_general_fields = false; } $output = ''; // Add nonce for custom fields. $output .= wp_nonce_field('wooframework-custom-fields', 'wooframework-custom-fields-nonce', true, false); if ($callback['id'] == 'woothemes-settings') { // Add tabs. $output .= '<div class="wooframework-tabs">' . "\n"; $output .= '<ul class="tabber hide-if-no-js">' . "\n"; if ($display_general_fields) { $output .= '<li class="wf-tab-general"><a href="#wf-tab-general">' . __('General Settings', 'woothemes') . '</a></li>' . "\n"; } // Allow themes/plugins to add tabs to WooFramework custom fields. $output .= apply_filters('wooframework_custom_field_tab_headings', ''); $output .= '</ul>' . "\n"; } if ($display_general_fields) { $output .= woothemes_metabox_create_fields($woo_metaboxes, $callback, 'general'); } // Allow themes/plugins to add tabs to WooFramework custom fields. $output = apply_filters('wooframework_custom_field_tab_content', $output); $output .= '</div>' . "\n"; echo $output; }
/** * woothemes_metabox_create function. * * @access public * @param object $post * @param array $callback * @return void */ function woothemes_metabox_create($post, $callback) { global $post; // Allow child themes/plugins to act here. do_action('woothemes_metabox_create', $post, $callback); $seo_post_types = array('post', 'page'); if (defined('SEOPOSTTYPES')) { $seo_post_types_update = unserialize(constant('SEOPOSTTYPES')); } if (!empty($seo_post_types_update)) { $seo_post_types = $seo_post_types_update; } $template_to_show = $callback['args']; $woo_metaboxes = get_option('woo_custom_template', array()); $seo_metaboxes = get_option('woo_custom_seo_template', array()); if (empty($seo_metaboxes) && $template_to_show == 'seo') { return; } // Array sanity check. if (!is_array($woo_metaboxes)) { $woo_metaboxes = array(); } // Determine whether or not to display general fields. $display_general_fields = true; if (count($woo_metaboxes) <= 0) { $display_general_fields = false; } // Determine whether or not to display SEO fields. $display_seo_fields = true; if (get_option('seo_woo_hide_fields') == 'true' || get_option('seo_woo_use_third_party_data') == 'true') { $display_seo_fields = false; } $output = ''; // Add nonce for custom fields. $output .= wp_nonce_field('wooframework-custom-fields', 'wooframework-custom-fields-nonce', true, false); if ($callback['id'] == 'woothemes-settings') { // Add tabs. $output .= '<div class="wooframework-tabs">' . "\n"; $output .= '<ul class="tabber hide-if-no-js">' . "\n"; if ($display_general_fields) { $output .= '<li class="wf-tab-general"><a href="#wf-tab-general">' . __('General Settings', 'woothemes') . '</a></li>' . "\n"; } if ($display_seo_fields) { $output .= '<li class="wf-tab-seo"><a href="#wf-tab-seo">' . __('SEO', 'woothemes') . '</a></li>' . "\n"; } // Allow themes/plugins to add tabs to WooFramework custom fields. $output .= apply_filters('wooframework_custom_field_tab_headings', ''); $output .= '</ul>' . "\n"; } if ($display_general_fields) { $output .= woothemes_metabox_create_fields($woo_metaboxes, $callback, 'general'); } if ($display_seo_fields && array_search(get_post_type(), $seo_post_types) !== false) { $output .= woothemes_metabox_create_fields($seo_metaboxes, $callback, 'seo'); } // Allow themes/plugins to add tabs to WooFramework custom fields. $output = apply_filters('wooframework_custom_field_tab_content', $output); $output .= '</div>' . "\n"; echo $output; }