array( 'post', 'nova_menu_item' ), 'args' => array( 'hierarchical' => false, 'meta_box_cb' => false, 'show_in_nav_menus' => false, 'show_ui' => true, 'query_var' => 'ingredients', 'labels' => array( 'name' => _x( 'Ingredients', 'Taxonomy label: name', 'wm_domain' ), 'singular_name' => _x( 'Ingredient', 'Taxonomy label: singular_name', 'wm_domain' ), 'search_items' => _x( 'Search Ingredients', 'Taxonomy label: search_items', 'wm_domain' ), 'all_items' => _x( 'All Ingredients', 'Taxonomy label: all_items', 'wm_domain' ), 'edit_item' => _x( 'Edit Ingredient', 'Taxonomy label: edit_item', 'wm_domain' ), 'update_item' => _x( 'Update Ingredient', 'Taxonomy label: update_item', 'wm_domain' ), 'add_new_item' => _x( 'Add New Ingredient', 'Taxonomy label: add_new_item', 'wm_domain' ), 'new_item_name' => _x( 'New Ingredient Title', 'Taxonomy label: new_item_name', 'wm_domain' ), ) ) ); //Output return $taxonomies; } add_filter( 'wmhook_wmamp_custom_taxonomies', 'wm_recipe_taxonomies', 10 ); } // /wm_recipe_taxonomies /** * CUSTOM METABOXES */ if ( function_exists( 'wma_add_meta_box' ) ) { /** * Menu item metaboxes */ /** * Recipes metafields * * @since 1.1 * @version 1.3 * * @param array $fields Array of predefined metafields * * @return array Modified $fields array */ function wm_recipes_metafields( $fields = array() ) { //Helper variables $users = get_users( apply_filters( 'wmhook_wm_recipes_metafields_get_users', array( 'fields' => array( 'id', 'display_name' ), 'orderby' => 'nicename', ) ) ); $cooks = array( '' => __( '- Recipe (post) author -', 'wm_domain' ), '_custom' => __( '- Enter custom name -', 'wm_domain' ), ); foreach ( $users as $key => $user ) { $cooks[ $user->id ] = $user->display_name; } //"Recipe" tab $fields[10] = array( 'type' => 'section-open', 'id' => 'recipe', 'title' => _x( 'Recipe', 'Food recipe metabox secion title.', 'wm_domain' ), ); $fields[20] = array( 'type' => 'text', 'id' => 'recipe-title', 'label' => __( 'Recipe title', 'wm_domain' ), 'description' => __( 'If set, this title will override the post title.', 'wm_domain' ), ); $fields[30] = array( 'type' => 'select', 'id' => 'cook', 'label' => _x( 'Cook', 'Recipe cook name selector label.', 'wm_domain' ), 'description' => __( 'Select a cook, author of this recipe.', 'wm_domain' ), 'options' => $cooks, ); $fields[35] = array( 'type' => 'textarea', //To allow for HTML tags 'id' => 'cook-custom', 'label' => _x( 'Cook name', 'Recipe cook custom name input field label.', 'wm_domain' ), 'description' => __( 'Enter a cook name here.', 'wm_domain' ), 'attributes' => 'rows="1"', 'conditional' => array( 'option_value' => array( '_custom' ), 'option' => array( 'tag' => 'select', 'name' => 'wm-cook', ), ), ); $fields[40] = array( 'type' => 'select', 'id' => 'difficulty', 'label' => _x( 'Difficulty', 'Recipe difficulty level selector label.', 'wm_domain' ), 'description' => __( 'Recipe difficulty level.', 'wm_domain' ), 'options' => array( '' => '', _x( 'Beginner', 'Recipe difficulty level option title.', 'wm_domain' ) => _x( 'Beginner', 'Recipe difficulty level option title.', 'wm_domain' ), _x( 'Intermediate', 'Recipe difficulty level option title.', 'wm_domain' ) => _x( 'Intermediate', 'Recipe difficulty level option title.', 'wm_domain' ), _x( 'Advanced', 'Recipe difficulty level option title.', 'wm_domain' ) => _x( 'Advanced', 'Recipe difficulty level option title.', 'wm_domain' ), ), ); $fields[50] = array( 'type' => 'text', 'id' => 'yield', 'label' => _x( 'Yield', 'The quantity produced by the recipe (for example, number of people served, number of servings, etc).', 'wm_domain' ), 'description' => __( 'The quantity produced by the recipe (for example, number of people served, number of servings, etc).', 'wm_domain' ), ); $fields[60] = array( 'type' => 'slider', 'id' => 'time-prep', 'label' => __( 'Prep time', 'wm_domain' ), 'description' => __( 'Recipe preparation time in minutes.', 'wm_domain' ), 'default' => 5, 'min' => 0, 'max' => 150, 'step' => 5, ); $fields[70] = array( 'type' => 'slider', 'id' => 'time-cook', 'label' => __( 'Cook time', 'wm_domain' ), 'description' => __( 'Recipe cooking time in minutes.', 'wm_domain' ), 'default' => 0, 'min' => 0, 'max' => 150, 'step' => 5, ); $fields[80] = array( 'type' => 'textarea', 'id' => 'nutrition', 'label' => __( 'Nutrition info text', 'wm_domain' ), 'attributes' => 'rows="2"', ); $fields[90] = array( 'type' => 'repeater', 'id' => 'nutrition-facts', 'label' => __( 'Nutrition facts', 'wm_domain' ), 'description' => __( 'Enter a value with a unit of the nutrition fact. For example "10g", or "10%".', 'wm_domain' ), 'fields' => array( array( 'type' => 'select', 'id' => 'fact', 'label' => __( 'Nutrition title', 'wm_domain' ), 'options' => wm_helper_var( 'nutrition-facts' ), ), array( 'type' => 'text', 'id' => 'value', 'label' => __( 'Value', 'wm_domain' ), ), ), ); $fields[190] = array( 'type' => 'section-close', ); // /section //"Ingredients" tab $fields[200] = array( 'type' => 'section-open', 'id' => 'ingredients', 'title' => _x( 'Ingredients', 'Food recipe metabox secion title.', 'wm_domain' ), ); $fields[220] = array( 'type' => 'repeater', 'id' => 'ingredients', 'label' => __( 'Ingredients required for the recipe', 'wm_domain' ), 'fields' => array( array( 'type' => 'text', 'id' => 'ingredient', 'class' => 'form-input-tip', 'label' => __( 'Ingredient', 'wm_domain' ), 'description' => __( 'Start typing the ingredient name. If the ingredient already exists, it will be suggested to you. Otherwise new ingredient will be created.', 'wm_domain' ), 'attributes' => 'placeholder="' . __( 'Ingredient', 'wm_domain' ) . '" title="' . __( 'Start typing the ingredient name. If the ingredient already exists, it will be suggested to you. Otherwise new ingredient will be created.', 'wm_domain' ) . '"', ), array( 'type' => 'text', 'id' => 'info', 'label' => __( 'Additional info', 'wm_domain' ), 'description' => __( 'This info will be displayed after the ingredient name. You can use this for the amount info, for example.', 'wm_domain' ), 'attributes' => 'placeholder="' . __( 'Additional info', 'wm_domain' ) . '" title="' . __( 'This info will be displayed after the ingredient name. You can use this for the amount info, for example.', 'wm_domain' ) . '"', ), ), ); $fields[390] = array( 'type' => 'section-close', ); // /section //"Instructions" tab $fields[400] = array( 'type' => 'section-open', 'id' => 'instructions', 'title' => _x( 'Instructions', 'Food recipe metabox secion title.', 'wm_domain' ), ); $fields[410] = array( 'type' => 'textarea', 'id' => 'instructions', 'label' => __( 'Recipe preparation instructions', 'wm_domain' ), 'description' => __( 'Recipe instructions text. Put your instructions into ordered list. You can also insert media, such as images, video or audio.', 'wm_domain' ), 'editor' => true, ); $fields[590] = array( 'type' => 'section-close', ); // /section /** * For more form fields options please check the PHP files inside * the "wm-amplifier/includes/metabox/fields/" folder. */ return $fields; } // /wm_recipes_metafields wma_add_meta_box( array( // Meta fields function callback (should return array of fields). // The function callback is used for to use a WordPress globals // available during the metabox rendering, such as $post. 'fields' => 'wm_recipes_metafields', // Meta box id, unique per meta box. 'id' => 'recipes-metabox', // Post types. 'pages' => array( 'post', 'nova_menu_item' ), // Meta box title. 'title' => _x( 'Recipe setup', 'Metabox title.', 'wm_domain' ), ) ); } // /wma_add_meta_box function check ?>