├── CONTRIBUTING.md ├── README.md ├── composer └── composer.json ├── conditional-display ├── better-include.php └── include-by-ID-or-page-template.php ├── extensions ├── conditional-logic │ ├── featured-image-with-tabs.php │ └── featured-image.php ├── frontend-submission │ ├── auto-generate-post-title.php │ └── disable-comments.php ├── mb-blocks │ └── hero │ │ ├── register.php │ │ ├── style.css │ │ └── template.php ├── mb-settings-page │ ├── conditional-tabs.php │ └── theme-options.php ├── mb-user-profile │ ├── edit-user-email.php │ └── register-user-manually.php └── meta-box-group │ └── parse-sub-fields-values.php ├── features └── select-advanced-ajax-sources.php ├── fields ├── background.php ├── button-group.php ├── checkbox-list.php ├── checkbox.php ├── custom-html.php ├── custom │ └── select-with-optgroup.php ├── datetime.php ├── fieldset-text.php ├── file.php ├── image-select.php ├── image.php ├── key-value.php ├── map.php ├── number.php ├── oembed.php ├── osm.php ├── post.php ├── radio.php ├── range.php ├── select.php ├── sidebar.php ├── single-image.php ├── slider.php ├── switch.php ├── taxonomy-advanced.php ├── taxonomy.php ├── text-list.php ├── text.php ├── textarea.php ├── url.php ├── user.php ├── video.php └── wysiwyg.php ├── general ├── all-custom-post-types.php ├── contexts.php ├── demo.php ├── force-delete.php └── media-modal.php └── integration ├── add-user-meta-to-wc-pip-invoices.php ├── caldera-forms.php ├── contact-form-7.php ├── gravity-forms.php ├── ninja-forms.php └── relevanssi.php /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute To Meta Box Code Snippet Library 2 | 3 | The Meta Box code snippet library is a community-maintained repository and so contributions are always welcome. 4 | 5 | ## Submitting a Snippet 6 | 7 | To submit a code library for inclusion in the library, please fork the repository and then submit a [pull request](https://help.github.com/articles/about-pull-requests/). 8 | 9 | Guidelines for submission: 10 | 11 | - Each snippet should be placed in it's own file. 12 | - Each file should be named appropriately based on the purpose of the snippet. 13 | - Files should be placed in the appropriate category (folder). If no category exists, you may create one with your pull request. 14 | - All functions and classes should be prefixed with your own unique prefix, preferrably one that contains your initials followed by `_mb_`. For example: `rw_mb_{function name here}`. 15 | - (Optional) Add [WordPress plugin headers](http://codex.wordpress.org/File_Header#Plugin_File_Header_Example) to allow others to use your snippet as a plugin. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Meta Box Code Snippet Library 2 | 3 | This is a community-maintained repository of code snippets that help modify the default behavior of [Meta Box](https://metabox.io). 4 | 5 | Snippets are organized into categories (folders) and each snippet is placed in its own file with a name that describes what it does. 6 | 7 | ## Using Snippets 8 | 9 | Most files in this library are set up to be used within your WordPress theme or plugin: 10 | 11 | 1. Click on the filename of the snippet you'd like to use. 12 | 1. Click the "Raw" button (next to "Blame" and "History") at the top right. 13 | 1. Save the page from your browser to your plugin or theme folder. Be sure to save it as a .php file. 14 | 1. Open your theme's `functions.php` file (or your plugin main `.php` file) and include the new file. Or you can just copy and paste the code into your child theme's `functions.php` or place inside a custom functionality plugin. 15 | 16 | ## Submitting Your Snippet 17 | 18 | We welcome and encourage everyone to submit their code snippets. If you would like to submit your snippet, please [fork](https://github.com/wpmetabox/library/fork) the repository and then create a [pull request](https://github.com/wpmetabox/library/compare/). 19 | 20 | Please refer to the [Contributing guidelines](https://github.com/wpmetabox/library/blob/master/CONTRIBUTING.md) before submitting your pull request. 21 | 22 | ## Proposing a Snippet 23 | 24 | If there is a snippet you are unable to find and would like to propose get written, please open an [issue](https://github.com/wpmetabox/library/issues) and describe your need. 25 | 26 | ## Notes 27 | 28 | This is not a tutorial archive. Please see the [plugin documentation](https://docs.metabox.io) if you're looking for instructions on how to implement these snippets (and others). 29 | 30 | These snippets come with no guarantees. Due to the constant evolution of the Meta Box codebase, it is possible that the behavior of these snippets may change overtime. Find something broken? [Let us know](https://github.com/wpmetabox/library/issues)! 31 | -------------------------------------------------------------------------------- /composer/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "repositories":[ 3 | { 4 | "type": "composer", 5 | "url": "https://packages.metabox.io/YOUR_LICENSE_KEY" 6 | } 7 | ], 8 | "require": { 9 | "composer/installers": "^1", 10 | "meta-box/dependency": "dev-main", 11 | "meta-box/mb-admin-columns": "dev-master", 12 | "meta-box/mb-blocks": "dev-master", 13 | "meta-box/mb-custom-table": "dev-master", 14 | "meta-box/mb-frontend-submission": "dev-master", 15 | "meta-box/mb-revision": "dev-master", 16 | "meta-box/mb-settings-page": "dev-master", 17 | "meta-box/mb-term-meta": "dev-master", 18 | "meta-box/mb-user-meta": "dev-master", 19 | "meta-box/mb-user-profile": "dev-master", 20 | "meta-box/mb-views": "dev-master", 21 | "meta-box/meta-box-columns": "dev-master", 22 | "meta-box/meta-box-conditional-logic": "dev-master", 23 | "meta-box/meta-box-geolocation": "dev-master", 24 | "meta-box/meta-box-group": "dev-master", 25 | "meta-box/meta-box-include-exclude": "dev-master", 26 | "meta-box/meta-box-show-hide": "dev-master", 27 | "meta-box/meta-box-tabs": "dev-master", 28 | "meta-box/meta-box-template": "dev-master", 29 | "meta-box/meta-box-tooltip": "dev-master", 30 | "wpmetabox/mb-acf-migration": "dev-master", 31 | "wpmetabox/mb-comment-meta": "dev-master", 32 | "wpmetabox/mb-custom-post-type": "dev-master", 33 | "wpmetabox/mb-divi-integrator": "dev-main", 34 | "wpmetabox/mb-elementor-integrator": "dev-master", 35 | "wpmetabox/mb-rank-math": "dev-master", 36 | "wpmetabox/mb-relationships": "dev-master", 37 | "wpmetabox/mb-rest-api": "dev-master", 38 | "wpmetabox/mb-toolset-migration": "dev-master", 39 | "wpmetabox/mb-yoast-seo": "dev-master", 40 | "wpmetabox/meta-box": "dev-master", 41 | "wpmetabox/meta-box-beaver-themer-integrator": "dev-master", 42 | "wpmetabox/meta-box-builder": "dev-master", 43 | "wpmetabox/meta-box-facetwp-integrator": "dev-master", 44 | "wpmetabox/text-limiter": "dev-master" 45 | }, 46 | "extra": { 47 | "installer-paths": { 48 | "vendor/meta-box/{$name}": ["vendor:wpmetabox", "vendor:meta-box"] 49 | } 50 | }, 51 | "autoload": { 52 | "files": [ 53 | "vendor/meta-box/meta-box/meta-box.php", 54 | "vendor/meta-box/mb-comment-meta/mb-comment-meta.php", 55 | "vendor/meta-box/mb-custom-post-type/mb-custom-post-type.php", 56 | "vendor/meta-box/mb-elementor-integrator/mb-elementor-integrator.php", 57 | "vendor/meta-box/mb-relationships/mb-relationships.php", 58 | "vendor/meta-box/mb-rest-api/mb-rest-api.php", 59 | "vendor/meta-box/meta-box-beaver-themer-integrator/meta-box-beaver-themer-integrator.php", 60 | "vendor/meta-box/meta-box-facetwp-integrator/meta-box-facetwp-integrator.php", 61 | "vendor/meta-box/meta-box-text-limiter/text-limiter.php", 62 | "vendor/meta-box/meta-box-yoast-seo/mb-yoast-seo.php", 63 | "vendor/meta-box/mb-admin-columns/mb-admin-columns.php", 64 | "vendor/meta-box/mb-blocks/mb-blocks.php", 65 | "vendor/meta-box/mb-custom-table/mb-custom-table.php", 66 | "vendor/meta-box/mb-frontend-submission/mb-frontend-submission.php", 67 | "vendor/meta-box/mb-revision/mb-revision.php", 68 | "vendor/meta-box/mb-settings-page/mb-settings-page.php", 69 | "vendor/meta-box/mb-term-meta/mb-term-meta.php", 70 | "vendor/meta-box/mb-user-meta/mb-user-meta.php", 71 | "vendor/meta-box/mb-user-profile/mb-user-profile.php", 72 | "vendor/meta-box/meta-box-aio/meta-box-aio.php", 73 | "vendor/meta-box/meta-box-builder/meta-box-builder.php", 74 | "vendor/meta-box/meta-box-columns/meta-box-columns.php", 75 | "vendor/meta-box/meta-box-conditional-logic/meta-box-conditional-logic.php", 76 | "vendor/meta-box/meta-box-geolocation/meta-box-geolocation.php", 77 | "vendor/meta-box/meta-box-group/meta-box-group.php", 78 | "vendor/meta-box/meta-box-include-exclude/meta-box-include-exclude.php", 79 | "vendor/meta-box/meta-box-show-hide/meta-box-show-hide.php", 80 | "vendor/meta-box/meta-box-tabs/meta-box-tabs.php", 81 | "vendor/meta-box/meta-box-template/meta-box-template.php", 82 | "vendor/meta-box/meta-box-tooltip/meta-box-tooltip.php" 83 | ] 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /conditional-display/better-include.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | 14 | add_filter( 'rwmb_meta_boxes', 'YOURPREFIX_register_meta_boxes' ); 15 | 16 | /** 17 | * Register meta boxes 18 | * 19 | * @param $meta_boxes 20 | * @return array 21 | */ 22 | function YOURPREFIX_register_meta_boxes( $meta_boxes ) { 23 | $prefix = 'rw_'; 24 | $meta_boxes[] = array( 25 | 'title' => __( 'Meta Box Title', 'textdomain' ), 26 | 'fields' => array( 27 | array( 28 | 'name' => __( 'Your images', 'textdomain' ), 29 | 'id' => "{$prefix}img", 30 | 'type' => 'plupload_image', 31 | ), 32 | ), 33 | 'only_on' => array( 34 | 'id' => array( 1, 2 ), 35 | // 'slug' => array( 'news', 'blog' ), 36 | 'template' => array( 'fullwidth.php', 'simple.php' ), 37 | 'parent' => array( 10 ), 38 | ), 39 | ); 40 | 41 | foreach ( $meta_boxes as $k => $meta_box ) { 42 | if ( isset( $meta_box['only_on'] ) && ! rw_maybe_include( $meta_box['only_on'] ) ) { 43 | unset( $meta_boxes[ $k ] ); 44 | } 45 | } 46 | 47 | return $meta_boxes; 48 | } 49 | 50 | /** 51 | * Check if meta boxes is included 52 | * 53 | * @return bool 54 | */ 55 | function rw_maybe_include( $conditions ) { 56 | // Always include in the frontend to make helper function work 57 | if ( ! is_admin() ) { 58 | return true; 59 | } 60 | 61 | // Always include for ajax 62 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { 63 | return true; 64 | } 65 | 66 | if ( isset( $_GET['post'] ) ) { 67 | $post_id = intval( $_GET['post'] ); 68 | } elseif ( isset( $_POST['post_ID'] ) ) { 69 | $post_id = intval( $_POST['post_ID'] ); 70 | } else { 71 | $post_id = false; 72 | } 73 | 74 | $post_id = (int) $post_id; 75 | $post = get_post( $post_id ); 76 | 77 | foreach ( $conditions as $cond => $v ) { 78 | // Catch non-arrays too 79 | if ( ! is_array( $v ) ) { 80 | $v = array( $v ); 81 | } 82 | 83 | switch ( $cond ) { 84 | case 'id': 85 | if ( in_array( $post_id, $v ) ) { 86 | return true; 87 | } 88 | break; 89 | case 'parent': 90 | $post_parent = $post->post_parent; 91 | if ( in_array( $post_parent, $v ) ) { 92 | return true; 93 | } 94 | break; 95 | case 'slug': 96 | $post_slug = $post->post_name; 97 | if ( in_array( $post_slug, $v ) ) { 98 | return true; 99 | } 100 | break; 101 | case 'category': // post must be saved or published first 102 | $categories = get_the_category( $post->ID ); 103 | $catslugs = array(); 104 | foreach ( $categories as $category ) { 105 | array_push( $catslugs, $category->slug ); 106 | } 107 | if ( array_intersect( $catslugs, $v ) ) { 108 | return true; 109 | } 110 | break; 111 | case 'template': 112 | $template = get_post_meta( $post_id, '_wp_page_template', true ); 113 | if ( in_array( $template, $v ) ) { 114 | return true; 115 | } 116 | break; 117 | }// End switch(). 118 | }// End foreach(). 119 | 120 | // If no condition matched 121 | return false; 122 | } 123 | -------------------------------------------------------------------------------- /conditional-display/include-by-ID-or-page-template.php: -------------------------------------------------------------------------------- 1 | 'any_id', 29 | 'title' => __( 'Meta Box Title', 'textdomain' ), 30 | 'post_types' => 'page', 31 | 'fields' => array( 32 | array( 33 | 'name' => __( 'Your images', 'textdomain' ), 34 | 'id' => "{$prefix}img", 35 | 'type' => 'plupload_image', 36 | ), 37 | ), 38 | ); 39 | 40 | return $meta_boxes; 41 | } 42 | 43 | /** 44 | * Check if meta boxes is included 45 | * 46 | * @return bool 47 | */ 48 | function rw_maybe_include() { 49 | // Always include in the frontend to make helper function work 50 | if ( ! is_admin() ) { 51 | return true; 52 | } 53 | 54 | // Always include for ajax 55 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { 56 | return true; 57 | } 58 | 59 | // Check for post IDs 60 | $checked_post_IDs = array( 61, 63, 65, 67, 2 ); 61 | 62 | if ( isset( $_GET['post'] ) ) { 63 | $post_id = intval( $_GET['post'] ); 64 | } elseif ( isset( $_POST['post_ID'] ) ) { 65 | $post_id = intval( $_POST['post_ID'] ); 66 | } else { $post_id = false; 67 | } 68 | 69 | $post_id = (int) $post_id; 70 | 71 | if ( in_array( $post_id, $checked_post_IDs ) ) { 72 | return true; 73 | } 74 | 75 | // Check for page template 76 | $checked_templates = array( 'full-width.php', 'sidebar-page.php' ); 77 | 78 | $template = get_post_meta( $post_id, '_wp_page_template', true ); 79 | if ( in_array( $template, $checked_templates ) ) { 80 | return true; 81 | } 82 | 83 | // If no condition matched 84 | return false; 85 | } 86 | -------------------------------------------------------------------------------- /extensions/conditional-logic/featured-image-with-tabs.php: -------------------------------------------------------------------------------- 1 | 'Post/Page Options', 15 | 'fields' => array( 16 | array( 17 | 'id' => 'featured_image_layout_options', 18 | 'type' => 'radio', 19 | 'options' => array( 20 | 'show_below_title' => 'Featured Image Below Title', 21 | 'show_above_title' => 'Featured Image Above Title', 22 | ), 23 | 'tab' => 'featured_image_options', 24 | 'inline' => false, 25 | 'std' => array( 26 | 'show_below_title', 27 | ), 28 | ), 29 | array( 30 | 'id' => 'page_options_hide_title', 31 | 'type' => 'checkbox', 32 | 'desc' => 'Hide Post/Page Title', 33 | 'tab' => 'hide_post_page_elements', 34 | ), 35 | array( 36 | 'id' => 'hide_widget_one', 37 | 'type' => 'checkbox', 38 | 'desc' => 'Hide Footer Widget One', 39 | 'tab' => 'hide-footer-widgets', 40 | ), 41 | array( 42 | 'id' => 'hide_widget_two', 43 | 'type' => 'checkbox', 44 | 'desc' => 'Hide Footer Widget Two', 45 | 'tab' => 'hide-footer-widgets', 46 | ), 47 | array( 48 | 'id' => 'hide_widget_three', 49 | 'type' => 'checkbox', 50 | 'desc' => 'Hide Footer Widget Three', 51 | 'tab' => 'hide-footer-widgets', 52 | ), 53 | array( 54 | 'id' => 'hide_widget_four', 55 | 'type' => 'checkbox', 56 | 'desc' => 'Hide Footer Widget Four', 57 | 'tab' => 'hide-footer-widgets', 58 | ), 59 | array( 60 | 'id' => 'hide_widget_five', 61 | 'type' => 'checkbox', 62 | 'desc' => 'Hide Footer Widget Five', 63 | 'tab' => 'hide-footer-widgets', 64 | ), 65 | array( 66 | 'id' => 'remove_content_area_padding', 67 | 'type' => 'checkbox', 68 | 'desc' => 'Remove Content Area Padding', 69 | 'tab' => 'page_builder_options', 70 | ), 71 | ), 72 | 'tab_style' => 'left', 73 | 'tab_wrapper' => true, 74 | 'tabs' => array( 75 | 'featured_image_options' => array( 76 | 'label' => 'Featured Image Options', 77 | 'icon' => 'dashicons-arrow-right', 78 | ), 79 | 'hide_post_page_elements' => array( 80 | 'label' => 'Hide Post/Page Elements', 81 | 'icon' => 'dashicons-arrow-right', 82 | ), 83 | 'hide-footer-widgets' => array( 84 | 'label' => 'Hide Footer Widgets', 85 | 'icon' => 'dashicons-arrow-right', 86 | ), 87 | 'page_builder_options' => array( 88 | 'label' => 'Page Builder Options', 89 | 'icon' => 'dashicons-arrow-right', 90 | ), 91 | ), 92 | ); 93 | return $meta_boxes; 94 | } ); 95 | 96 | add_filter( 'rwmb_outside_conditions', function ( $conditions ) { 97 | $conditions['.rwmb-tab-featured_image_options'] = array( 98 | 'visible' => array( '_thumbnail_id', '!=', '-1' ), 99 | ); 100 | $conditions['.rwmb-tab-panel-featured_image_options'] = array( 101 | 'visible' => array( '_thumbnail_id', '!=', '-1' ), 102 | ); 103 | return $conditions; 104 | } ); 105 | -------------------------------------------------------------------------------- /extensions/conditional-logic/featured-image.php: -------------------------------------------------------------------------------- 1 | 'Homepage Settings', 8 | 'visible' => array( '_thumbnail_id', '!=', '-1' ), // Visible when featured image is set. 9 | 'fields' => array( 10 | array( 11 | 'id' => 'heading', 12 | 'name' => 'Heading Text', 13 | 'type' => 'text', 14 | ), 15 | ), 16 | ); 17 | 18 | return $meta_boxes; 19 | } ); 20 | -------------------------------------------------------------------------------- /extensions/frontend-submission/auto-generate-post-title.php: -------------------------------------------------------------------------------- 1 | /** 2 | * This snippet auto generates post title for submitted posts. 3 | * It's useful when you don't want users to enter post title. 4 | */ 5 | 6 | add_filter( 'rwmb_frontend_insert_post_data', function( $data, $config ) { 7 | if ( $config['id'] = 'your-meta-box-id' ) { 8 | $data['post_title'] = date( 'Y-m-d' ); 9 | } 10 | return $data; 11 | }, 10, 2 ); 12 | -------------------------------------------------------------------------------- /extensions/frontend-submission/disable-comments.php: -------------------------------------------------------------------------------- 1 | 'Hero Area', 6 | 'id' => 'hero-area', 7 | 'type' => 'block', // Important. 8 | 9 | // 'icon' => 'awards', // Or you can set a custom SVG if you don't like Dashicons 10 | 'icon' => '', 11 | 'category' => 'layout', 12 | // 'context' => 'side', // The block settings will be available on the right sidebar. 13 | 'supports' => [ 14 | 'align' => ['wide', 'full'], 15 | ], 16 | 17 | 'render_template' => get_stylesheet_directory() . '/blocks/hero/template.php', // The PHP template that renders the block. 18 | 'enqueue_style' => get_stylesheet_directory_uri() . '/blocks/hero/style.css', // CSS file for the block. 19 | 20 | // Now register the block fields. 21 | 'fields' => [ 22 | [ 23 | 'type' => 'single_image', 24 | 'id' => 'image', 25 | 'name' => 'Image', 26 | ], 27 | [ 28 | 'type' => 'text', 29 | 'id' => 'title', 30 | 'name' => 'Title', 31 | ], 32 | [ 33 | 'type' => 'text', 34 | 'id' => 'subtitle', 35 | 'name' => 'Subtitle', 36 | ], 37 | [ 38 | 'type' => 'textarea', 39 | 'id' => 'content', 40 | 'name' => 'Content', 41 | ], 42 | [ 43 | 'type' => 'single_image', 44 | 'id' => 'signature', 45 | 'name' => 'Signature', 46 | ], 47 | [ 48 | 'type' => 'text', 49 | 'id' => 'button_text', 50 | 'name' => 'Button Text', 51 | ], 52 | [ 53 | 'type' => 'text', 54 | 'id' => 'button_url', 55 | 'name' => 'Button URL', 56 | ], 57 | [ 58 | 'type' => 'color', 59 | 'id' => 'background_color', 60 | 'name' => 'Background Color', 61 | ], 62 | ], 63 | ]; 64 | return $meta_boxes; 65 | } ); 66 | -------------------------------------------------------------------------------- /extensions/mb-blocks/hero/style.css: -------------------------------------------------------------------------------- 1 | /* Custom style for the block */ 2 | @import url('https://fonts.googleapis.com/css?family=Istok+Web|Lato:700&display=swap'); 3 | .hero { 4 | display: flex; 5 | justify-content: space-between; 6 | align-items: center; 7 | 8 | color: #212121; 9 | font: 18px/1.6 "Istok Web", sans-serif; 10 | padding: 90px 60px 0; 11 | } 12 | .hero__image { 13 | min-width: 470px; 14 | margin-right: 40px; 15 | } 16 | .hero h2 { 17 | font: bold 60px/1.3 Lato, sans-serif; 18 | margin: 0 0 11px; 19 | } 20 | .hero h3 { 21 | font-size: 24px; 22 | font-family: inherit; 23 | font-weight: 400; 24 | line-height: 1.3; 25 | text-transform: uppercase; 26 | } 27 | .hero__line { 28 | margin: 24px 0 34px; 29 | width: 60px; 30 | height: 2px; 31 | background: #ff5722; 32 | } 33 | .hero__button { 34 | border: 2px solid #212121; 35 | font-weight: 700; 36 | font-size: 14px; 37 | display: inline-block; 38 | text-align: center; 39 | line-height: 1; 40 | padding: 13px 20px; 41 | text-transform: uppercase; 42 | text-decoration: none; 43 | transition: all .3s; 44 | color: #212121; 45 | } 46 | .hero__button:hover { 47 | background: #212121; 48 | color: #fff; 49 | text-decoration: none; 50 | } 51 | .hero__content, 52 | .hero__signature { 53 | margin-bottom: 30px; 54 | } 55 | -------------------------------------------------------------------------------- /extensions/mb-blocks/hero/template.php: -------------------------------------------------------------------------------- 1 | 27 | 28 |
29 | 30 | 31 |
32 |

33 |

34 | 35 |
36 | 37 |
38 | 39 | 40 | 41 | 42 | 43 |

44 | 45 |
46 |
47 | -------------------------------------------------------------------------------- /extensions/mb-settings-page/conditional-tabs.php: -------------------------------------------------------------------------------- 1 | 'pencil', 12 | 'option_name' => 'pencil', 13 | 'menu_title' => __( 'Pencil', 'textdomain' ), 14 | 'icon_url' => 'dashicons-edit', 15 | 'style' => 'no-boxes', 16 | 'columns' => 1, 17 | 'tabs' => array( 18 | 'general' => __( 'General Settings', 'textdomain' ), 19 | 'design' => __( 'Design Customization', 'textdomain' ), 20 | ), 21 | 'position' => 68, 22 | ); 23 | 24 | if ( class_exists( 'WooCommerce' ) ) { 25 | $my_settings_page['tabs']['faq'] = __( 'FAQ & Help', 'textdomain' ); 26 | } 27 | 28 | $settings_pages[] = $my_settings_page; 29 | 30 | return $settings_pages; 31 | } 32 | 33 | // Register meta boxes and fields for settings page 34 | add_filter( 'rwmb_meta_boxes', 'prefix_options_meta_boxes' ); 35 | function prefix_options_meta_boxes( $meta_boxes ) { 36 | $meta_boxes[] = array( 37 | 'id' => 'general', 38 | 'title' => __( 'General', 'textdomain' ), 39 | 'settings_pages' => 'pencil', 40 | 'tab' => 'general', 41 | 42 | 'fields' => array( 43 | array( 44 | 'name' => __( 'Facebook', 'textdomain' ), 45 | 'id' => 'facebook', 46 | 'type' => 'text', 47 | ), 48 | array( 49 | 'name' => __( 'Logo', 'textdomain' ), 50 | 'id' => 'logo', 51 | 'type' => 'file_input', 52 | ), 53 | array( 54 | 'name' => __( 'Layout', 'textdomain' ), 55 | 'id' => 'layout', 56 | 'type' => 'image_select', 57 | 'options' => array( 58 | 'sidebar-left' => 'http://i.imgur.com/Y2sxQ2R.png', 59 | 'sidebar-right' => 'http://i.imgur.com/h7ONxhz.png', 60 | 'no-sidebar' => 'http://i.imgur.com/m7oQKvk.png', 61 | ), 62 | ), 63 | ), 64 | ); 65 | $meta_boxes[] = array( 66 | 'id' => 'colors', 67 | 'title' => __( 'Colors', 'textdomain' ), 68 | 'settings_pages' => 'pencil', 69 | 'tab' => 'design', 70 | 71 | 'fields' => array( 72 | array( 73 | 'name' => __( 'Heading Color', 'textdomain' ), 74 | 'id' => 'heading-color', 75 | 'type' => 'color', 76 | ), 77 | array( 78 | 'name' => __( 'Text Color', 'textdomain' ), 79 | 'id' => 'text-color', 80 | 'type' => 'color', 81 | ), 82 | ), 83 | ); 84 | 85 | if ( class_exists( 'WooCommerce' ) ) { 86 | $meta_boxes[] = array( 87 | 'id' => 'info', 88 | 'title' => __( 'Theme Info', 'textdomain' ), 89 | 'settings_pages' => 'pencil', 90 | 'tab' => 'faq', 91 | 'fields' => array( 92 | array( 93 | 'type' => 'custom_html', 94 | 'std' => __( 'Having questions?

Go to our documentation', 'textdomain' ), 95 | ), 96 | ), 97 | ); 98 | } 99 | 100 | return $meta_boxes; 101 | } 102 | -------------------------------------------------------------------------------- /extensions/mb-settings-page/theme-options.php: -------------------------------------------------------------------------------- 1 | 'theme-slug', 6 | 'option_name' => 'theme_slug', 7 | 'menu_title' => __( 'Theme Options', 'textdomain' ), 8 | 'parent' => 'themes.php', 9 | 'help_tabs' => array( 10 | array( 11 | 'title' => 'General', 12 | 'content' => '

This tab displays the general information about the theme.

', 13 | ), 14 | array( 15 | 'title' => 'Homepage', 16 | 'content' => '

This tab displays the instruction for setting up the homepage.

', 17 | ), 18 | ), 19 | ); 20 | 21 | return $settings_pages; 22 | } ); 23 | 24 | // Register meta boxes and fields for settings page 25 | add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) { 26 | $meta_boxes[] = array( 27 | 'id' => 'general', 28 | 'title' => __( 'General', 'textdomain' ), 29 | 'settings_pages' => 'theme-slug', 30 | 'fields' => array( 31 | array( 32 | 'name' => __( 'Logo', 'textdomain' ), 33 | 'id' => 'logo', 34 | 'type' => 'file_input', 35 | ), 36 | array( 37 | 'name' => __( 'Layout', 'textdomain' ), 38 | 'id' => 'layout', 39 | 'type' => 'image_select', 40 | 'options' => array( 41 | 'sidebar-left' => 'http://i.imgur.com/Y2sxQ2R.png', 42 | 'sidebar-right' => 'http://i.imgur.com/h7ONxhz.png', 43 | 'no-sidebar' => 'http://i.imgur.com/m7oQKvk.png', 44 | ), 45 | ), 46 | ), 47 | ); 48 | $meta_boxes[] = array( 49 | 'id' => 'colors', 50 | 'title' => __( 'Colors', 'textdomain' ), 51 | 'settings_pages' => 'theme-slug', 52 | 'fields' => array( 53 | array( 54 | 'name' => __( 'Heading Color', 'textdomain' ), 55 | 'id' => 'heading-color', 56 | 'type' => 'color', 57 | ), 58 | array( 59 | 'name' => __( 'Text Color', 'textdomain' ), 60 | 'id' => 'text-color', 61 | 'type' => 'color', 62 | ), 63 | ), 64 | ); 65 | 66 | $meta_boxes[] = array( 67 | 'id' => 'info', 68 | 'title' => __( 'Theme Info', 'textdomain' ), 69 | 'context' => 'side', 70 | 'settings_pages' => 'theme-slug', 71 | 'fields' => array( 72 | array( 73 | 'type' => 'custom_html', 74 | 'std' => '' . __( '%Name% is a responsive theme for businesses and agencies. Built with HTML5, SASS and other latest technologies.

Learn more', 'textdomain' ), 75 | ), 76 | ), 77 | ); 78 | 79 | return $meta_boxes; 80 | } ); 81 | -------------------------------------------------------------------------------- /extensions/mb-user-profile/edit-user-email.php: -------------------------------------------------------------------------------- 1 | 'Edit User Email', 9 | 'id' => 'edit-user-email', 10 | 'type' => 'user', 11 | 'fields' => [ 12 | [ 13 | 'type' => 'email', 14 | 'id' => 'user_email', 15 | 'name' => 'Email', 16 | 'std' => wp_get_current_user()->user_email, 17 | ] 18 | ], 19 | ]; 20 | return $meta_boxes; 21 | } ); 22 | 23 | /** 24 | * Then add the following shortcode into a page: 25 | * 26 | * [mb_user_profile_info id="edit-user-email"] 27 | */ 28 | -------------------------------------------------------------------------------- /extensions/mb-user-profile/register-user-manually.php: -------------------------------------------------------------------------------- 1 | 'my_user', 24 | 'user_email' => 'myemail@domain.com', 25 | 'user_pass' => 'my_user_pass', 26 | ]; 27 | return $data; 28 | }, 10, 2 ); 29 | 30 | // Meta box for register form. 31 | add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) { 32 | $meta_boxes[] = [ 33 | 'title' => 'my form', 34 | 'id' => 'my-form', 35 | 'type' => 'user', 36 | 'fields' => [ 37 | [ 38 | 'name' => 'Text', 39 | 'id' => 'text', 40 | 'type' => 'text', 41 | ], 42 | [ 43 | 'name' => 'Textarea', 44 | 'id' => 'textarea', 45 | 'type' => 'textarea', 46 | 'cols' => 20, 47 | 'rows' => 3, 48 | ], 49 | ], 50 | ]; 51 | 52 | return $meta_boxes; 53 | } ); 54 | 55 | -------------------------------------------------------------------------------- /extensions/meta-box-group/parse-sub-fields-values.php: -------------------------------------------------------------------------------- 1 | 'setting' ), 'settings_option_name' ); 13 | $found = []; 14 | array_walk_recursive($group_values, function($value, $key) use (&$found) { 15 | $found[$key] = $value; 16 | }); 17 | return $found; 18 | -------------------------------------------------------------------------------- /features/select-advanced-ajax-sources.php: -------------------------------------------------------------------------------- 1 | 'Fetch options via Ajax', 10 | 'fields' => [ 11 | [ 12 | 'type' => 'select_advanced', 13 | 'id' => 's', 14 | 'name' => 'Select2 Ajax', 15 | 'ajax_callback' => 'test_callback', 16 | 'ajax_initial_callback' => 'test_initial_callback', 17 | 'multiple' => true, 18 | ] 19 | ], 20 | ]; 21 | return $meta_boxes; 22 | } ); 23 | 24 | /** 25 | * The callback function that returns all items. 26 | * The format follows select2's documentation: https://select2.org/data-sources/formats 27 | */ 28 | function test_callback() { 29 | return [ 30 | "results" => [ 31 | [ 32 | "id" => '1', 33 | "text" => 'So 1', 34 | ], 35 | [ 36 | "id" => '2', 37 | "text" => 'So 2', 38 | ], 39 | [ 40 | "id" => '3', 41 | "text" => 'So 3', 42 | ], 43 | ] 44 | ]; 45 | } 46 | 47 | /** 48 | * The callback function that returns selected items when page initially loads. 49 | * The format is an array of items. Each item is array( 'id' => 'value', 'text' => 'label' ). 50 | */ 51 | function test_initial_callback( $selected_values ) { 52 | $items = [ 53 | 1 => 'So 1', 54 | 2 => 'So 2', 55 | 3 => 'So 3', 56 | ]; 57 | $return = []; 58 | foreach ( $selected_values as $selected_value ) { 59 | if ( ! isset( $items[$selected_value] ) ) { 60 | continue; 61 | } 62 | $return[] = [ 63 | 'id' => $selected_value, 64 | 'text' => $items[$selected_value], 65 | ]; 66 | } 67 | 68 | return $return; 69 | } 70 | -------------------------------------------------------------------------------- /fields/background.php: -------------------------------------------------------------------------------- 1 | __( 'Background demo', 'textdomain' ), 12 | 'fields' => array( 13 | array( 14 | 'name' => __( 'Background', 'textdomain' ), 15 | 'id' => 'background_demo', 16 | 'type' => 'background', 17 | // 'clone' => true, 18 | ), 19 | ), 20 | ); 21 | return $meta_boxes; 22 | } 23 | -------------------------------------------------------------------------------- /fields/button-group.php: -------------------------------------------------------------------------------- 1 | __( 'Button group demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | 'name' => esc_html__( 'Text label', 'textdomain' ), 13 | 'id' => "button_group_label_text", 14 | 'type' => 'button_group', 15 | // Array of 'value' => 'Label' pairs for radio options. 16 | // Note: the 'value' is stored in meta field, not the 'Label' 17 | 'options' => array( 18 | 'button1' => esc_html__( 'Button 1', 'textdomain' ), 19 | 'button2' => esc_html__( 'Button 2', 'textdomain' ), 20 | 'button3' => esc_html__( 'Button 3', 'textdomain' ), 21 | 'button4' => esc_html__( 'Button 4', 'textdomain' ), 22 | 'button5' => esc_html__( 'Button 5', 'textdomain' ), 23 | ), 24 | 25 | // Display inline? value : true - false 26 | 'inline' => true, 27 | 28 | // Display multiple? value : true - false 29 | // 'multiple' => true, 30 | 'clone' => true, 31 | ), 32 | 33 | array( 34 | 'name' => esc_html__( 'With icon + multiple choices', 'textdomain' ), 35 | 'id' => "button_group_label_icon", 36 | 'type' => 'button_group', 37 | // Array of 'value' => 'Label' pairs for radio options. 38 | // Note: the 'value' is stored in meta field, not the 'Label' 39 | 'options' => array( 40 | 'bold' => '', 41 | 'italic' => '', 42 | 'alignleft' => '', 43 | 'aligncenter' => '', 44 | 'alignright' => '', 45 | ), 46 | 47 | // Display inline? value : true - false 48 | 'inline' => true, 49 | 50 | // Display multiple? value : true - false 51 | 'multiple' => true, 52 | 'clone' => true, 53 | ), 54 | 55 | array( 56 | 'name' => esc_html__( 'Vertical icons', 'textdomain' ), 57 | 'id' => "button_group_label_icon_position_inline", 58 | 'type' => 'button_group', 59 | // Array of 'value' => 'Label' pairs for radio options. 60 | // Note: the 'value' is stored in meta field, not the 'Label' 61 | 'options' => array( 62 | 'rss' => '', 63 | 'twitter' => '', 64 | 'facebook' => '', 65 | 'googleplus' => '', 66 | ), 67 | 68 | // Display inline? value : true - false 69 | 'inline' => false, 70 | 71 | // Display multiple? value : true - false 72 | 'multiple' => true, 73 | 'clone' => true, 74 | ), 75 | ), 76 | 77 | ); 78 | return $meta_boxes; 79 | } 80 | -------------------------------------------------------------------------------- /fields/checkbox-list.php: -------------------------------------------------------------------------------- 1 | __( 'Checkbox List Demo', 'textdomain' ), 8 | 9 | 'fields' => array( 10 | array( 11 | 'name' => __( 'Checkbox List', 'textdomain' ), 12 | 'id' => 'checkbox_list', 13 | 'type' => 'checkbox_list', 14 | 'select_all_none' => true, 15 | 16 | // Array of 'value' => 'Label' pairs for radio options. 17 | // Note: the 'value' is stored in meta field, not the 'Label' 18 | 'options' => array( 19 | 'value1' => __( 'Label1', 'textdomain' ), 20 | 'value2' => __( 'Label2', 'textdomain' ), 21 | ), 22 | ), 23 | ), 24 | ); 25 | 26 | return $meta_boxes; 27 | } ); -------------------------------------------------------------------------------- /fields/checkbox.php: -------------------------------------------------------------------------------- 1 | __( 'Checkbox Upload Demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | 'id' => 'checkbox', 13 | 'name' => __( 'Checkbox', 'textdomain' ), 14 | 'type' => 'checkbox', 15 | 'desc' => __( 'Check or not check?', 'textdomain' ), 16 | ), 17 | ), 18 | ); 19 | return $meta_boxes; 20 | } 21 | -------------------------------------------------------------------------------- /fields/custom-html.php: -------------------------------------------------------------------------------- 1 | __( 'Custom HTML Demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | // Field name: usually not used 13 | // 'name' => __( 'Custom HTML', 'textdomain' ), 14 | 'type' => 'custom_html', 15 | 16 | // HTML content 17 | 'std' => '
Please be careful with the data entered in each field
', 18 | 19 | // Callback function to show custom HTML 20 | // 'callback' => 'display_warning', 21 | ), 22 | ), 23 | ); 24 | return $meta_boxes; 25 | } 26 | -------------------------------------------------------------------------------- /fields/custom/select-with-optgroup.php: -------------------------------------------------------------------------------- 1 | ', 21 | self::render_attributes( $attributes ) 22 | ); 23 | if ( ! $field['multiple'] && $field['placeholder'] ) { 24 | $output .= ''; 25 | } 26 | $output .= $walker->walk( $options, $field['flatten'] ? -1 : 0 ); 27 | $output .= ''; 28 | $output .= self::get_select_all_html( $field ); 29 | return $output; 30 | } 31 | } 32 | 33 | class RWMB_Walker_Selectomatic extends RWMB_Walker_Select { 34 | 35 | public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { 36 | $meta = $this->meta; 37 | if($depth){ 38 | $output .= sprintf( 39 | '', 40 | esc_attr( $object->value ), 41 | selected( in_array( $object->value, $meta ), true, false ), 42 | esc_html( RWMB_Field::filter( 'choice_label', $object->label, $this->field, $object ) 43 | ) 44 | ); 45 | } 46 | else{ 47 | $output .= sprintf( 48 | '', 49 | esc_html( RWMB_Field::filter( 'choice_label', $object->label, $this->field, $object ) 50 | ) 51 | ); 52 | } 53 | } 54 | 55 | public function rwmb_end_html_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { 56 | if(!$depth){ 57 | $output .= ''; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /fields/datetime.php: -------------------------------------------------------------------------------- 1 | __( 'Date Time Picker With JS Options', 'textdomain' ), 8 | 9 | 'fields' => array( 10 | array( 11 | 'name' => __( 'Date', 'textdomain' ), 12 | 'id' => $prefix . 'date', 13 | 'type' => 'date', 14 | 15 | // jQuery date picker options. See here http://jqueryui.com/demos/datepicker 16 | 'js_options' => array( 17 | 'appendText' => __( '(yyyy-mm-dd)', 'textdomain' ), 18 | 'autoSize' => true, 19 | 'buttonText' => __( 'Select Date', 'textdomain' ), 20 | 'dateFormat' => __( 'yy-mm-dd', 'textdomain' ), 21 | 'numberOfMonths' => 2, 22 | 'showButtonPanel' => true, 23 | ), 24 | ), 25 | array( 26 | 'name' => __( 'Inline Date', 'textdomain' ), 27 | 'id' => $prefix . 'inline-date', 28 | 'type' => 'date', 29 | 30 | // jQuery date picker options. See here http://jqueryui.com/demos/datepicker 31 | 'js_options' => array( 32 | 'appendText' => __( '(yyyy-mm-dd)', 'textdomain' ), 33 | 'autoSize' => true, 34 | 'buttonText' => __( 'Select Date', 'textdomain' ), 35 | 'dateFormat' => __( 'yy-mm-dd', 'textdomain' ), 36 | 'numberOfMonths' => 2, 37 | 'showButtonPanel' => true, 38 | ), 39 | 'inline' => true, 40 | ), 41 | array( 42 | 'name' => __( 'Datetime', 'textdomain' ), 43 | 'id' => $prefix . 'datetime', 44 | 'type' => 'datetime', 45 | 46 | // jQuery datetime picker options. See here http://trentrichardson.com/examples/timepicker/ 47 | 'js_options' => array( 48 | 'stepMinute' => 15, 49 | 'showTimepicker' => true, 50 | ), 51 | ), 52 | array( 53 | 'name' => __( 'Time', 'textdomain' ), 54 | 'id' => $prefix . 'time', 55 | 'type' => 'time', 56 | 57 | // jQuery datetime picker options. See here http://trentrichardson.com/examples/timepicker/ 58 | 'js_options' => array( 59 | 'stepMinute' => 5, 60 | 'showSecond' => true, 61 | 'stepSecond' => 10, 62 | ), 63 | ), 64 | ), 65 | ); 66 | 67 | return $meta_boxes; 68 | } 69 | -------------------------------------------------------------------------------- /fields/fieldset-text.php: -------------------------------------------------------------------------------- 1 | __( 'Fieldset Text Demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | 'id' => 'fieldset_text', 13 | 'name' => __( 'Fieldset Text', 'textdomain' ), 14 | 'type' => 'fieldset_text', 15 | 16 | 'desc' => __( 'Please enter following details:', 'textdomain' ), 17 | 18 | // Options: array of Label => key for text boxes 19 | // Note: key is used as key of array of values stored in the database 20 | // Number of options are not limited 21 | 'options' => array( 22 | 'name' => __( 'Name', 'textdomain' ), 23 | 'address' => __( 'Address', 'textdomain' ), 24 | 'email' => __( 'Email', 'textdomain' ), 25 | ), 26 | ), 27 | ), 28 | ); 29 | return $meta_boxes; 30 | } 31 | -------------------------------------------------------------------------------- /fields/file.php: -------------------------------------------------------------------------------- 1 | __( 'File Upload Demo', 'textdomain' ), 12 | 'fields' => array( 13 | array( 14 | 'id' => 'file', 15 | 'name' => __( 'File', 'textdomain' ), 16 | 'type' => 'file', 17 | 18 | // Delete file from Media Library when remove it from post meta? 19 | // Note: it might affect other posts if you use same file for multiple posts. 20 | // 'force_delete' => true, 21 | 22 | // Maximum file uploads. 23 | // 'max_file_uploads' => 2, 24 | ), 25 | array( 26 | 'id' => 'file2', 27 | 'name' => __( 'File Clone', 'textdomain' ), 28 | 'type' => 'file', 29 | 'force_delete' => true, 30 | 'clone' => true, 31 | ), 32 | array( 33 | 'id' => 'file_advanced', 34 | 'name' => __( 'File Advanced', 'textdomain' ), 35 | 'type' => 'file_advanced', 36 | 'force_delete' => false, 37 | 'max_file_uploads' => 2, 38 | ), 39 | array( 40 | 'id' => 'file_upload', 41 | 'name' => __( 'File Upload', 'textdomain' ), 42 | 'type' => 'file_upload', 43 | 'force_delete' => false, 44 | 'max_file_uploads' => 2, 45 | ), 46 | array( 47 | 'id' => 'file_input', 48 | 'name' => __( 'File Input', 'textdomain' ), 49 | 'type' => 'file_input', 50 | 51 | // Input field placeholder. 52 | 'placeholder' => __( 'Please select a file or paste file URL here', 'textdomain' ), 53 | 54 | // Input size. 55 | 'size' => 60, 56 | ), 57 | ), 58 | ); 59 | return $meta_boxes; 60 | } 61 | -------------------------------------------------------------------------------- /fields/image-select.php: -------------------------------------------------------------------------------- 1 | __( 'Image Select Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'id' => 'image_select', 12 | 'name' => __( 'Layout', 'textdomain' ), 13 | 'type' => 'image_select', 14 | 15 | // Array of 'value' => 'Image Source' pairs 16 | 'options' => array( 17 | 'left' => 'http://placehold.it/90x90&text=Left', 18 | 'right' => 'http://placehold.it/90x90&text=Right', 19 | 'none' => 'http://placehold.it/90x90&text=None', 20 | ), 21 | 22 | // Allow to select multiple values? Default is false 23 | // 'multiple' => true, 24 | ), 25 | ), 26 | ); 27 | return $meta_boxes; 28 | } 29 | -------------------------------------------------------------------------------- /fields/image.php: -------------------------------------------------------------------------------- 1 | esc_html__( 'Image Upload Demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | 'name' => __( 'Single Image', 'textdomain' ), 13 | 'id' => 'single_img', 14 | 'type' => 'single_image', 15 | // 'clone' => true, 16 | ), 17 | array( 18 | 'id' => 'image', 19 | 'name' => esc_html__( 'Image Gallery', 'textdomain' ), 20 | 'type' => 'image', 21 | 22 | // Delete image from Media Library when remove it from post meta?. 23 | // Note: it might affect other posts if you use same image for multiple posts. 24 | 'force_delete' => false, 25 | 26 | // Maximum image uploads. 27 | 'max_file_uploads' => 2, 28 | ), 29 | array( 30 | 'id' => 'image_advanced', 31 | 'name' => esc_html__( 'Image Advanced', 'textdomain' ), 32 | 'type' => 'image_advanced', 33 | 34 | // Delete image from Media Library when remove it from post meta?. 35 | // Note: it might affect other posts if you use same image for multiple posts. 36 | 'force_delete' => false, 37 | 38 | // Maximum image uploads. 39 | 'max_file_uploads' => 2, 40 | 41 | // Display the "Uploaded 1/2 files" status. 42 | 'max_status' => true, 43 | 44 | 'image_size' => 'medium', 45 | ), 46 | array( 47 | 'id' => 'plupload_image', 48 | 'name' => esc_html__( 'Plupload Image (Alias of Image Upload)', 'textdomain' ), 49 | 'type' => 'plupload_image', 50 | 51 | // Delete image from Media Library when remove it from post meta?. 52 | // Note: it might affect other posts if you use same image for multiple posts. 53 | 'force_delete' => false, 54 | 55 | // Maximum image uploads. 56 | 'max_file_uploads' => 2, 57 | 58 | // Display the "Uploaded 1/2 files" status. 59 | 'max_status' => true, 60 | ), 61 | array( 62 | 'id' => 'image_upload', 63 | 'name' => esc_html__( 'Image Upload', 'textdomain' ), 64 | 'type' => 'image_upload', 65 | 66 | // Delete image from Media Library when remove it from post meta?. 67 | // Note: it might affect other posts if you use same image for multiple posts. 68 | 'force_delete' => false, 69 | 70 | // Maximum image uploads. 71 | 'max_file_uploads' => 2, 72 | 73 | // Display the "Uploaded 1/2 files" status. 74 | 'max_status' => true, 75 | ), 76 | ), 77 | ); 78 | 79 | return $meta_boxes; 80 | } 81 | -------------------------------------------------------------------------------- /fields/key-value.php: -------------------------------------------------------------------------------- 1 | __( 'Key Value Demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | 'id' => 'key_value', 13 | 'name' => __( 'Key Value', 'textdomain' ), 14 | 'type' => 'key_value', 15 | 16 | 'desc' => __( 'Add more additional info below:', 'textdomain' ), 17 | ), 18 | ), 19 | ); 20 | return $meta_boxes; 21 | } 22 | -------------------------------------------------------------------------------- /fields/map.php: -------------------------------------------------------------------------------- 1 | __( 'Google Map', 'textdomain' ), 12 | 'fields' => array( 13 | // Map requires at least one address field (with type = text). 14 | array( 15 | 'id' => 'address', 16 | 'name' => __( 'Address', 'textdomain' ), 17 | 'type' => 'text', 18 | 'std' => __( 'Hanoi, Vietnam', 'textdomain' ), 19 | ), 20 | array( 21 | 'id' => 'map', 22 | 'name' => __( 'Location', 'textdomain' ), 23 | 'type' => 'map', 24 | 25 | // Your Google Maps API key. Required. 26 | 'api_key' => 'XXXXXXXXX', 27 | 28 | // Address field ID. Can be a string or list of text fields, separated by commas (for ex. city, state). 29 | 'address_field' => 'address', 30 | 31 | // Map language. 32 | 'language' => 'ru_RU', 33 | 34 | // The region code, specified as a country code top-level domain. For better autocomplete address. 35 | 'region' => 'ru', 36 | 37 | // Default location: 'latitude,longitude[,zoom]' (zoom is optional). 38 | 'std' => '-6.233406,-35.049906,15', 39 | ), 40 | ), 41 | ); 42 | 43 | return $meta_boxes; 44 | } ); 45 | -------------------------------------------------------------------------------- /fields/number.php: -------------------------------------------------------------------------------- 1 | __( 'Number Field Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'id' => 'number', 12 | 'name' => __( 'Number', 'textdomain' ), 13 | 'type' => 'number', 14 | 15 | // Number step. Set to 'any' to accept float value 16 | 'step' => 'any', 17 | 18 | // Minimum value 19 | 'min' => 0, 20 | 21 | // Placeholder 22 | 'placeholder' => __( 'Enter number:', 'textdomain' ), 23 | ), 24 | ), 25 | ); 26 | 27 | return $meta_boxes; 28 | } 29 | -------------------------------------------------------------------------------- /fields/oembed.php: -------------------------------------------------------------------------------- 1 | __( 'oEmbed Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'id' => 'oembed', 12 | 'name' => __( 'oEmbed(s)', 'textdomain' ), 13 | 'type' => 'oembed', 14 | 15 | // Allow to clone? Default is false 16 | 'clone' => false, 17 | 18 | // Input size 19 | 'size' => 30, 20 | ), 21 | ), 22 | ); 23 | return $meta_boxes; 24 | } 25 | -------------------------------------------------------------------------------- /fields/osm.php: -------------------------------------------------------------------------------- 1 | 'Test Open Street Map Field', 9 | 'fields' => [ 10 | [ 11 | 'type' => 'text', 12 | 'id' => 't', 13 | 'name' => 'Address', 14 | ], 15 | [ 16 | 'type' => 'osm', 17 | 'id' => 'osm', 18 | 'name' => 'Open Street Map', 19 | 'region' => 'vn', // Limit search results to a specific country (or a list of countries). Accepts ISO 3166-1alpha2 code. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 20 | 'language' => 'vi', // Used for display auto-complete results. Accepts standard rfc2616 "accept-language" string or a simple comma separated list of language codes. https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html 21 | 'address_field' => 't', 22 | ], 23 | ], 24 | ]; 25 | return $meta_boxes; 26 | } ); 27 | -------------------------------------------------------------------------------- /fields/post.php: -------------------------------------------------------------------------------- 1 | __( 'Post Field Demo', 'textdomain' ), 9 | 10 | 'fields' => array( 11 | array( 12 | 'name' => __( 'Post', 'textdomain' ), 13 | 'id' => 'post', 14 | 'type' => 'post', 15 | 16 | // 'clone' => true, 17 | // 'multiple' => true, 18 | // Post type: string (for single post type) or array (for multiple post types) 19 | 'post_type' => array( 'page' ), 20 | 21 | // Default selected value (post ID) 22 | // 'std' => 1, 23 | 24 | // Field type, either 'select' or 'select_advanced' (default) 25 | // 'field_type' => 'select_advanced', 26 | // 'field_type' => 'checkbox_list', 27 | // 'field_type' => 'checkbox_tree', 28 | // 'field_type' => 'select_tree', 29 | 'field_type' => 'radio_list', 30 | // 'inline' => false, 31 | 32 | // Placeholder 33 | 'placeholder' => __( 'Select an Item', 'textdomain' ), 34 | 35 | // Query arguments (optional). No settings means get all published posts 36 | // @see https://codex.wordpress.org/Class_Reference/WP_Query 37 | 'query_args' => array( 38 | 'post_status' => 'publish', 39 | 'posts_per_page' => - 1, 40 | ), 41 | ), 42 | ), 43 | ); 44 | 45 | return $meta_boxes; 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /fields/radio.php: -------------------------------------------------------------------------------- 1 | __( 'Radio Field Demo', 'textdomain' ), 9 | 10 | 'fields' => array( 11 | array( 12 | 'name' => __( 'Radio', 'textdomain' ), 13 | 'id' => 'radio', 14 | 'type' => 'radio', 15 | 16 | // Array of 'value' => 'Label' pairs for radio options. 17 | // Note: the 'value' is stored in meta field, not the 'Label' 18 | 'options' => array( 19 | 'value1' => __( 'Label1', 'textdomain' ), 20 | 'value2' => __( 'Label2', 'textdomain' ), 21 | ), 22 | ), 23 | ), 24 | ); 25 | 26 | return $meta_boxes; 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /fields/range.php: -------------------------------------------------------------------------------- 1 | __( 'Range Field Demo', 'textdomain' ), 9 | 10 | 'fields' => array( 11 | array( 12 | 'name' => __( 'Range', 'textdomain' ), 13 | 'id' => 'range', 14 | 'type' => 'range', 15 | 'desc' => __( 'Background Opacity', 'textdomain' ), 16 | 17 | // Minimum value 18 | 'min' => 0, 19 | // Maximum value 20 | 'max' => 60, 21 | // Step 22 | 'step' => 5, 23 | ), 24 | ), 25 | ); 26 | 27 | return $meta_boxes; 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /fields/select.php: -------------------------------------------------------------------------------- 1 | __( 'Select Field Demo', 'textdomain' ), 9 | 10 | 'fields' => array( 11 | array( 12 | 'name' => __( 'Select', 'textdomain' ), 13 | 'id' => 'select_simple', 14 | 'type' => 'select', 15 | 'options' => array( 16 | 'value1' => __( 'Label1', 'textdomain' ), 17 | 'value2' => __( 'Label2', 'textdomain' ), 18 | ), 19 | ), 20 | array( 21 | 'name' => __( 'Select', 'textdomain' ), 22 | 'id' => 'select', 23 | 'type' => 'select', 24 | 25 | 'clone' => true, 26 | 27 | // Array of 'value' => 'Label' pairs for select box 28 | 'options' => array( 29 | 'value1' => __( 'Label1', 'textdomain' ), 30 | 'value2' => __( 'Label2', 'textdomain' ), 31 | ), 32 | 33 | // Select multiple values, optional. Default is false. 34 | 'multiple' => true, 35 | 36 | // Default selected value 37 | 'std' => 'value2', 38 | 39 | // Placeholder 40 | 'placeholder' => __( 'Select an Item', 'textdomain' ), 41 | ), 42 | array( 43 | 'name' => __( 'Select Advanced', 'textdomain' ), 44 | 'id' => 'select_advanced', 45 | 'type' => 'select_advanced', 46 | 47 | // Array of 'value' => 'Label' pairs for select box 48 | 'options' => array( 49 | 'value1' => __( 'Label1', 'textdomain' ), 50 | 'value2' => __( 'Label2', 'textdomain' ), 51 | ), 52 | 53 | // Select multiple values, optional. Default is false. 54 | 'multiple' => false, 55 | 56 | 'std' => 'value2', // Default value, optional 57 | 'placeholder' => __( 'Select an Item', 'textdomain' ), 58 | ), 59 | 60 | ), 61 | ); 62 | 63 | return $meta_boxes; 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /fields/sidebar.php: -------------------------------------------------------------------------------- 1 | __( 'Sidebar Field Demo', 'textdomain' ), 11 | 12 | 'fields' => array( 13 | array( 14 | 'name' => __( 'Sidebar', 'textdomain' ), 15 | 'id' => 'sidebar', 16 | 'type' => 'sidebar', 17 | 18 | // Field type: select, select_advanced, radio_list, checkbox_list. 19 | 'field_type' => 'select_advanced', 20 | 21 | // Placeholder. 22 | 'placeholder' => __( 'Select a sidebar', 'textdomain' ), 23 | 24 | // 'clone' => true, 25 | // 'multiple' => true, 26 | ), 27 | ), 28 | ); 29 | 30 | return $meta_boxes; 31 | } ); 32 | -------------------------------------------------------------------------------- /fields/single-image.php: -------------------------------------------------------------------------------- 1 | __( 'Single Image Demo', 'textdomain' ), 12 | 'fields' => array( 13 | array( 14 | 'name' => __( 'Single Image', 'textdomain' ), 15 | 'id' => 'single_img', 16 | 'type' => 'single_image', 17 | // 'clone' => true, 18 | ), 19 | ), 20 | ); 21 | return $meta_boxes; 22 | } 23 | -------------------------------------------------------------------------------- /fields/slider.php: -------------------------------------------------------------------------------- 1 | __( 'Slider Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'name' => __( 'Slider', 'textdomain' ), 12 | 'id' => 'slider', 13 | 'type' => 'slider', 14 | 15 | // Text labels displayed before and after value 16 | 'prefix' => __( '$', 'textdomain' ), 17 | 'suffix' => __( ' USD', 'textdomain' ), 18 | 19 | // jQuery UI slider options. See here http://api.jqueryui.com/slider/ 20 | 'js_options' => array( 21 | 'min' => 10, 22 | 'max' => 255, 23 | 'step' => 5, 24 | ), 25 | 26 | 'std' => 150, 27 | // 'clone' => true, 28 | ), 29 | ), 30 | ); 31 | return $meta_boxes; 32 | } 33 | -------------------------------------------------------------------------------- /fields/switch.php: -------------------------------------------------------------------------------- 1 | __( 'Check switch rounded demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | 'type' => 'switch', 13 | 'name' => esc_html__( 'Rounded no label', 'textdomain' ), 14 | 'id' => "switch_rounded", 15 | // Value can be 0 or 1 16 | 'std' => 1, 17 | 18 | ), 19 | array( 20 | 'type' => 'switch', 21 | 'name' => esc_html__( 'On-Off label', 'textdomain' ), 22 | 'id' => "switch_rounded_label", 23 | // Value can be 0 or 1 24 | 'std' => 1, 25 | 'on_label' => esc_html__( 'On', 'textdomain' ), 26 | 'off_label' => esc_html__( 'Off', 'textdomain' ), 27 | ), 28 | array( 29 | 'type' => 'switch', 30 | 'name' => esc_html__( 'With icon', 'textdomain' ), 31 | 'id' => "switch_rounded_label_true", 32 | // Value can be 0 or 1 33 | 'std' => 1, 34 | 'on_label' => '', 35 | 'off_label' => '', 36 | ), 37 | ), 38 | ); 39 | $meta_boxes[] = array( 40 | 'title' => __( 'Check switch square demo', 'textdomain' ), 41 | 'fields' => array( 42 | array( 43 | 'id' => 'switch_square', 44 | 'name' => __( 'Square no label', 'textdomain' ), 45 | 'type' => 'switch', 46 | 'std' => 1, 47 | 'style' => 'square', 48 | ), 49 | array( 50 | 'type' => 'switch', 51 | 'name' => esc_html__( 'Enable - Disable', 'textdomain' ), 52 | 'id' => "switch_square_label", 53 | // Value can be 0 or 1 54 | 'std' => 1, 55 | // 2 style: rounded and square 56 | 'style' => 'square', 57 | 'on_label' => esc_html__( 'Enable', 'textdomain' ), 58 | 'off_label' => esc_html__( 'Disable', 'textdomain' ), 59 | ), 60 | 61 | ), 62 | 63 | ); 64 | return $meta_boxes; 65 | } 66 | -------------------------------------------------------------------------------- /fields/taxonomy-advanced.php: -------------------------------------------------------------------------------- 1 | esc_html__( 'Taxonomy_Advanced Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'name' => esc_html__( 'Taxonomy', 'textdomain' ), 12 | 'id' => 'prefix_taxonomy_advanced', 13 | 'type' => 'taxonomy_advanced', 14 | 15 | // Can this be cloned? 16 | 'clone' => true, 17 | 18 | // Taxonomy name 19 | 'taxonomy' => 'category', 20 | 21 | // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional 22 | 'field_type' => 'select_tree', 23 | 24 | // Additional arguments for get_terms() function. Optional 25 | 'query_args' => array(), 26 | ), 27 | ), 28 | ); 29 | 30 | return $meta_boxes; 31 | } 32 | -------------------------------------------------------------------------------- /fields/taxonomy.php: -------------------------------------------------------------------------------- 1 | __( 'Taxonomy Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'name' => __( 'Taxonomy', 'textdomain' ), 12 | 'id' => 'prefix_taxonomy', 13 | 'type' => 'taxonomy', 14 | 15 | // Taxonomy name 16 | 'taxonomy' => 'category', 17 | 18 | // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional 19 | 'field_type' => 'select_tree', 20 | 21 | // Additional arguments for get_terms() function. Optional 22 | 'query_args' => array(), 23 | ), 24 | ), 25 | ); 26 | return $meta_boxes; 27 | } 28 | -------------------------------------------------------------------------------- /fields/text-list.php: -------------------------------------------------------------------------------- 1 | __( 'Text List Demo', 'textdomain' ), 10 | 'fields' => array( 11 | array( 12 | 'id' => 'text_list', 13 | 'name' => __( 'Text List', 'textdomain' ), 14 | 'type' => 'text_list', 15 | 16 | 'clone' => true, 17 | 18 | // Options: array of Placeholder => Label for text boxes 19 | // Number of options are not limited 20 | 'options' => array( 21 | 'John Smith' => __( 'Name', 'textdomain' ), 22 | 'name@domain.com' => __( 'Email', 'textdomain' ), 23 | ), 24 | ), 25 | ), 26 | ); 27 | return $meta_boxes; 28 | } 29 | -------------------------------------------------------------------------------- /fields/text.php: -------------------------------------------------------------------------------- 1 | __( 'Text Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'name' => __( 'Text', 'textdomain' ), 12 | 'label_description' => __( 'Label description', 'your' ), 13 | 'id' => 'text', 14 | 'desc' => __( 'Please enter some text above', 'textdomain' ), 15 | 'type' => 'text', 16 | 17 | // Default value (optional) 18 | // 'std' => __( 'Default text value', 'textdomain' ), 19 | 20 | // CLONES: Add to make the field cloneable (i.e. have multiple value) 21 | 'clone' => true, 22 | 23 | // Placeholder 24 | 'placeholder' => __( 'Enter something here', 'textdomain' ), 25 | 26 | // Input size 27 | 'size' => 30, 28 | 29 | // Datalist 30 | 'datalist' => array( 31 | // Unique ID for datalist 32 | 'id' => 'text_datalist', 33 | // List of predefined options 34 | 'options' => array( 35 | __( 'What', 'textdomain' ), 36 | __( 'When', 'textdomain' ), 37 | __( 'Where', 'textdomain' ), 38 | __( 'Why', 'textdomain' ), 39 | __( 'Who', 'textdomain' ), 40 | ), 41 | ), 42 | ), 43 | array( 44 | 'name' => __( 'Input Group', 'textdomain' ), 45 | 'id' => 'text', 46 | 'type' => 'text', 47 | 'prepend' => '$', 48 | 'append' => '.00', 49 | ), 50 | ), 51 | ); 52 | return $meta_boxes; 53 | } 54 | -------------------------------------------------------------------------------- /fields/textarea.php: -------------------------------------------------------------------------------- 1 | __( 'Textarea Demo', 'textdomain' ), 9 | 'fields' => array( 10 | array( 11 | 'name' => __( 'Textarea', 'textdomain' ), 12 | 'id' => 'textarea', 13 | 'desc' => __( 'Textarea description', 'textdomain' ), 14 | 'type' => 'textarea', 15 | 16 | // Default value (optional) 17 | 'std' => __( 'Default textarea value', 'textdomain' ), 18 | 19 | // CLONES: Add to make the field cloneable (i.e. have multiple value) 20 | // 'clone' => true, 21 | 22 | // Placeholder 23 | 'placeholder' => __( 'Enter something here', 'textdomain' ), 24 | 25 | // Number of rows 26 | 'rows' => 5, 27 | 28 | // Number of columns 29 | 'cols' => 5, 30 | ), 31 | ), 32 | ); 33 | return $meta_boxes; 34 | } 35 | -------------------------------------------------------------------------------- /fields/url.php: -------------------------------------------------------------------------------- 1 | __( 'URL Demo', 'textdomain' ), 6 | 'fields' => array( 7 | array( 8 | 'id' => 'url', 9 | 'name' => __( 'URL(s)', 'textdomain' ), 10 | 'type' => 'url', 11 | 12 | // Allow to clone? Default is false 13 | // 'clone' => true, 14 | ), 15 | ), 16 | ); 17 | return $meta_boxes; 18 | } 19 | -------------------------------------------------------------------------------- /fields/user.php: -------------------------------------------------------------------------------- 1 | __( 'User Field Demo', 'textdomain' ), 9 | 10 | 'fields' => array( 11 | array( 12 | 'name' => __( 'User', 'textdomain' ), 13 | 'id' => 'user', 14 | 'type' => 'user', 15 | 16 | // 'clone' => true, 17 | // 'multiple' => true, 18 | // Field type, either 'select' or 'select_advanced' (default) 19 | 'field_type' => 'radio_list', 20 | 'inline' => false, 21 | 22 | // Placeholder 23 | 'placeholder' => __( 'Select an author', 'textdomain' ), 24 | 25 | // Query arguments (optional). No settings means get all published users 26 | // @see https://codex.wordpress.org/Function_Reference/get_users 27 | 'query_args' => array(), 28 | ), 29 | ), 30 | ); 31 | 32 | return $meta_boxes; 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /fields/video.php: -------------------------------------------------------------------------------- 1 | esc_html__( 'Video Field Demo', 'textdomain' ), 9 | 10 | 'fields' => array( 11 | array( 12 | 'name' => esc_html__( 'Video', 'textdomain' ), 13 | 'id' => 'video', 14 | 'type' => 'video', 15 | 16 | // Maximum video uploads. 0 = unlimited. 17 | 'max_file_uploads' => 3, 18 | 19 | // Delete image from Media Library when remove it from post meta? 20 | // Note: it might affect other posts if you use same image for multiple posts 21 | 'force_delete' => false, 22 | 23 | // Display the "Uploaded 1/3 files" status 24 | 'max_status' => true, 25 | ), 26 | ), 27 | ); 28 | 29 | return $meta_boxes; 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /fields/wysiwyg.php: -------------------------------------------------------------------------------- 1 | 'Test WYSIWYG field (aka editor)', 5 | 'fields' => [ 6 | // WYSIWYG/RICH TEXT EDITOR 7 | array( 8 | 'name' => esc_html__( 'WYSIWYG / Rich Text Editor', 'your-prefix' ), 9 | 'id' => 'wysiwyg', 10 | 'type' => 'wysiwyg', 11 | // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save 12 | 'raw' => false, 13 | 'std' => esc_html__( 'WYSIWYG default value', 'your-prefix' ), 14 | 15 | // Editor settings, see wp_editor() function: look4wp.com/wp_editor 16 | 'options' => array( 17 | 'textarea_rows' => 4, 18 | 'teeny' => true, 19 | 'media_buttons' => false, 20 | ), 21 | ), 22 | ], 23 | ]; 24 | return $meta_boxes; 25 | } ); 26 | -------------------------------------------------------------------------------- /general/all-custom-post-types.php: -------------------------------------------------------------------------------- 1 | 'personal', 13 | 'title' => __( 'Personal Information', 'textdomain' ), 14 | 'post_types' => $post_types, 15 | 16 | 'fields' => array( 17 | array( 18 | 'name' => __( 'Full name', 'textdomain' ), 19 | 'id' => $prefix . 'fname', 20 | 'type' => 'text', 21 | ), 22 | ), 23 | ); 24 | 25 | // Other meta boxes go here 26 | return $meta_boxes; 27 | } 28 | -------------------------------------------------------------------------------- /general/contexts.php: -------------------------------------------------------------------------------- 1 | esc_html__( 'Form Top', 'textdomain' ), 10 | 'context' => 'form_top', 11 | 'style' => 'seamless', 12 | 'fields' => array( 13 | array( 14 | 'type' => 'custom_html', 15 | 'std' => '
This is a notice
', 16 | ), 17 | ), 18 | ); 19 | $meta_boxes[] = array( 20 | 'title' => esc_html__( 'After Post Title', 'textdomain' ), 21 | 'context' => 'after_title', 22 | 'style' => 'seamless', 23 | 'fields' => array( 24 | array( 25 | 'id' => 'featured', 26 | 'name' => esc_html__( 'Make this post featured?', 'textdomain' ), 27 | 'type' => 'checkbox', 28 | ), 29 | ), 30 | ); 31 | return $meta_boxes; 32 | } ); 33 | -------------------------------------------------------------------------------- /general/demo.php: -------------------------------------------------------------------------------- 1 | 'standard', 40 | 41 | // Meta box title - Will appear at the drag and drop handle bar. Required. 42 | 'title' => esc_html__( 'Standard Fields', 'textdomain' ), 43 | 44 | // Post types, accept custom post types as well - DEFAULT is 'post'. Can be array (multiple post types) or string (1 post type). Optional. 45 | 'post_types' => array( 'post', 'page' ), 46 | 47 | // Where the meta box appear: normal (default), advanced, side. Optional. 48 | 'context' => 'normal', 49 | 50 | // Order of meta box: high (default), low. Optional. 51 | 'priority' => 'high', 52 | 53 | // Auto save: true, false (default). Optional. 54 | 'autosave' => true, 55 | 56 | // List of meta fields 57 | 'fields' => array( 58 | // TEXT 59 | array( 60 | // Field name - Will be used as label 61 | 'name' => esc_html__( 'Text', 'textdomain' ), 62 | // Label description, display below field name (optional). 63 | 'label_description' => esc_html__( 'Some description', 'textdomain' ), 64 | // Field ID, i.e. the meta key 65 | 'id' => "{$prefix}text", 66 | // Field description (optional) 67 | 'desc' => esc_html__( 'Text description', 'textdomain' ), 68 | 'type' => 'text', 69 | // Default value (optional) 70 | 'std' => esc_html__( 'Default text value', 'textdomain' ), 71 | // CLONES: Add to make the field cloneable (i.e. have multiple value) 72 | 'clone' => true, 73 | ), 74 | // CHECKBOX 75 | array( 76 | 'name' => esc_html__( 'Checkbox', 'textdomain' ), 77 | 'id' => "{$prefix}checkbox", 78 | 'type' => 'checkbox', 79 | // Value can be 0 or 1 80 | 'std' => 1, 81 | ), 82 | // RADIO BUTTONS 83 | array( 84 | 'name' => esc_html__( 'Radio', 'textdomain' ), 85 | 'id' => "{$prefix}radio", 86 | 'type' => 'radio', 87 | // Array of 'value' => 'Label' pairs for radio options. 88 | // Note: the 'value' is stored in meta field, not the 'Label' 89 | 'options' => array( 90 | 'value1' => esc_html__( 'Label1', 'textdomain' ), 91 | 'value2' => esc_html__( 'Label2', 'textdomain' ), 92 | ), 93 | ), 94 | // SELECT BOX 95 | array( 96 | 'name' => esc_html__( 'Select', 'textdomain' ), 97 | 'id' => "{$prefix}select", 98 | 'type' => 'select', 99 | // Array of 'value' => 'Label' pairs for select box 100 | 'options' => array( 101 | 'java' => esc_html__( 'Java', 'textdomain' ), 102 | 'javascript' => esc_html__( 'JavaScript', 'textdomain' ), 103 | 'php' => esc_html__( 'PHP', 'textdomain' ), 104 | 'csharp' => esc_html__( 'C#', 'textdomain' ), 105 | 'objectivec' => esc_html__( 'Objective-C', 'textdomain' ), 106 | 'kotlin' => esc_html__( 'Kotlin', 'textdomain' ), 107 | 'swift' => esc_html__( 'Swift', 'textdomain' ), 108 | ), 109 | // Select multiple values, optional. Default is false. 110 | 'multiple' => true, 111 | 'std' => 'value2', 112 | 'placeholder' => esc_html__( 'Select an Item', 'textdomain' ), 113 | 'select_all_none' => true, 114 | ), 115 | // HIDDEN 116 | array( 117 | 'id' => "{$prefix}hidden", 118 | 'type' => 'hidden', 119 | // Hidden field must have predefined value 120 | 'std' => esc_html__( 'Hidden value', 'textdomain' ), 121 | ), 122 | // PASSWORD 123 | array( 124 | 'name' => esc_html__( 'Password', 'textdomain' ), 125 | 'id' => "{$prefix}password", 126 | 'type' => 'password', 127 | ), 128 | // TEXTAREA 129 | array( 130 | 'name' => esc_html__( 'Textarea', 'textdomain' ), 131 | 'desc' => esc_html__( 'Textarea description', 'textdomain' ), 132 | 'id' => "{$prefix}textarea", 133 | 'type' => 'textarea', 134 | 'cols' => 20, 135 | 'rows' => 3, 136 | ), 137 | ), 138 | 'validation' => array( 139 | 'rules' => array( 140 | "{$prefix}password" => array( 141 | 'required' => true, 142 | 'minlength' => 7, 143 | ), 144 | ), 145 | // optional override of default jquery.validate messages 146 | 'messages' => array( 147 | "{$prefix}password" => array( 148 | 'required' => esc_html__( 'Password is required', 'textdomain' ), 149 | 'minlength' => esc_html__( 'Password must be at least 7 characters', 'textdomain' ), 150 | ), 151 | ), 152 | ), 153 | ); 154 | 155 | // 2nd meta box 156 | $meta_boxes[] = array( 157 | 'title' => esc_html__( 'Advanced Fields', 'textdomain' ), 158 | 159 | 'fields' => array( 160 | // HEADING 161 | array( 162 | 'type' => 'heading', 163 | 'name' => esc_html__( 'Heading', 'textdomain' ), 164 | 'desc' => esc_html__( 'Optional description for this heading', 'textdomain' ), 165 | ), 166 | // SLIDER 167 | array( 168 | 'name' => esc_html__( 'Slider', 'textdomain' ), 169 | 'id' => "{$prefix}slider", 170 | 'type' => 'slider', 171 | 172 | // Text labels displayed before and after value 173 | 'prefix' => esc_html__( '$', 'textdomain' ), 174 | 'suffix' => esc_html__( ' USD', 'textdomain' ), 175 | 176 | // jQuery UI slider options. See here http://api.jqueryui.com/slider/ 177 | 'js_options' => array( 178 | 'min' => 10, 179 | 'max' => 255, 180 | 'step' => 5, 181 | ), 182 | 183 | // Default value 184 | 'std' => 155, 185 | ), 186 | // NUMBER 187 | array( 188 | 'name' => esc_html__( 'Number', 'textdomain' ), 189 | 'id' => "{$prefix}number", 190 | 'type' => 'number', 191 | 192 | 'min' => 0, 193 | 'step' => 5, 194 | ), 195 | // DATE 196 | array( 197 | 'name' => esc_html__( 'Date picker', 'textdomain' ), 198 | 'id' => "{$prefix}date", 199 | 'type' => 'date', 200 | 201 | // Date picker options. See here http://api.jqueryui.com/datepicker 202 | 'js_options' => array( 203 | 'dateFormat' => 'yy-mm-dd', 204 | 'showButtonPanel' => false, 205 | ), 206 | 207 | // Display inline? 208 | 'inline' => false, 209 | 210 | // Save value as timestamp? 211 | 'timestamp' => false, 212 | ), 213 | // DATETIME 214 | array( 215 | 'name' => esc_html__( 'Datetime picker', 'textdomain' ), 216 | 'id' => $prefix . 'datetime', 217 | 'type' => 'datetime', 218 | 219 | // jQuery datetime picker options. 220 | // For date options, see here http://api.jqueryui.com/datepicker 221 | // For time options, see here http://trentrichardson.com/examples/timepicker/ 222 | 'js_options' => array( 223 | 'stepMinute' => 15, 224 | 'showTimepicker' => true, 225 | 'controlType' => 'select', 226 | 'showButtonPanel' => false, 227 | 'oneLine' => true, 228 | ), 229 | ), 230 | // TIME 231 | array( 232 | 'name' => esc_html__( 'Time picker', 'textdomain' ), 233 | 'id' => $prefix . 'time', 234 | 'type' => 'time', 235 | 236 | // jQuery datetime picker options. 237 | // For date options, see here http://api.jqueryui.com/datepicker 238 | // For time options, see here http://trentrichardson.com/examples/timepicker/ 239 | 'js_options' => array( 240 | 'stepMinute' => 5, 241 | // 'showSecond' => true, 242 | // 'stepSecond' => 10, 243 | 'controlType' => 'select', 244 | ), 245 | 246 | 'inline' => true, 247 | ), 248 | // COLOR 249 | array( 250 | 'name' => esc_html__( 'Color picker', 'textdomain' ), 251 | 'id' => 'field_id', 252 | 'type' => 'color', 253 | // Add alpha channel? 254 | 'alpha_channel' => true, 255 | // Color picker options. See here: https://automattic.github.io/Iris/. 256 | 'js_options' => array( 257 | 'palettes' => array( '#125', '#459', '#78b', '#ab0', '#de3', '#f0f' ) 258 | ), 259 | ), 260 | // CHECKBOX LIST 261 | array( 262 | 'name' => esc_html__( 'Checkbox list', 'textdomain' ), 263 | 'id' => "{$prefix}checkbox_list", 264 | 'type' => 'checkbox_list', 265 | // Options of checkboxes, in format 'value' => 'Label' 266 | 'options' => array( 267 | 'java' => esc_html__( 'Java', 'textdomain' ), 268 | 'javascript' => esc_html__( 'JavaScript', 'textdomain' ), 269 | 'php' => esc_html__( 'PHP', 'textdomain' ), 270 | 'csharp' => esc_html__( 'C#', 'textdomain' ), 271 | 'objectivec' => esc_html__( 'Objective-C', 'textdomain' ), 272 | 'kotlin' => esc_html__( 'Kotlin', 'textdomain' ), 273 | 'swift' => esc_html__( 'Swift', 'textdomain' ), 274 | ), 275 | // Display options in a single row? 276 | // 'inline' => true, 277 | // Display "Select All / None" button? 278 | 'select_all_none' => true, 279 | ), 280 | // AUTOCOMPLETE 281 | array( 282 | 'name' => esc_html__( 'Autocomplete', 'textdomain' ), 283 | 'id' => "{$prefix}autocomplete", 284 | 'type' => 'autocomplete', 285 | // Options of autocomplete, in format 'value' => 'Label' 286 | 'options' => array( 287 | 'java' => esc_html__( 'Java', 'textdomain' ), 288 | 'javascript' => esc_html__( 'JavaScript', 'textdomain' ), 289 | 'php' => esc_html__( 'PHP', 'textdomain' ), 290 | 'c' => esc_html__( 'C', 'textdomain' ), 291 | 'cplusplus' => esc_html__( 'C++', 'textdomain' ), 292 | 'csharp' => esc_html__( 'C#', 'textdomain' ), 293 | 'objectivec' => esc_html__( 'Objective-C', 'textdomain' ), 294 | 'kotlin' => esc_html__( 'Kotlin', 'textdomain' ), 295 | 'swift' => esc_html__( 'Swift', 'textdomain' ), 296 | ), 297 | // Input size 298 | 'size' => 30, 299 | // Clone? 300 | // 'clone' => true, 301 | ), 302 | // RANGE 303 | array( 304 | 'name' => esc_html__( 'Range', 'textdomain' ), 305 | 'id' => "{$prefix}range", 306 | 'desc' => esc_html__( 'Range description', 'textdomain' ), 307 | 'type' => 'range', 308 | 'min' => 0, 309 | 'max' => 100, 310 | 'step' => 5, 311 | 'std' => 0, 312 | ), 313 | // OEMBED 314 | array( 315 | 'name' => esc_html__( 'oEmbed', 'textdomain' ), 316 | 'id' => "{$prefix}oembed", 317 | 'desc' => esc_html__( 'oEmbed description', 'textdomain' ), 318 | 'type' => 'oembed', 319 | ), 320 | // SELECT ADVANCED BOX 321 | array( 322 | 'name' => esc_html__( 'Select', 'textdomain' ), 323 | 'id' => "{$prefix}select_advanced", 324 | 'type' => 'select_advanced', 325 | // Array of 'value' => 'Label' pairs for select box 326 | 'options' => array( 327 | 'java' => esc_html__( 'Java', 'textdomain' ), 328 | 'javascript' => esc_html__( 'JavaScript', 'textdomain' ), 329 | 'php' => esc_html__( 'PHP', 'textdomain' ), 330 | 'csharp' => esc_html__( 'C#', 'textdomain' ), 331 | 'objectivec' => esc_html__( 'Objective-C', 'textdomain' ), 332 | 'kotlin' => esc_html__( 'Kotlin', 'textdomain' ), 333 | 'swift' => esc_html__( 'Swift', 'textdomain' ), 334 | ), 335 | // Select multiple values, optional. Default is false. 336 | 'multiple' => true, 337 | // 'std' => 'value2', // Default value, optional 338 | 'placeholder' => esc_html__( 'Select an Item', 'textdomain' ), 339 | 'select_all_none' => true, 340 | ), 341 | // TAXONOMY 342 | array( 343 | 'name' => esc_html__( 'Taxonomy', 'textdomain' ), 344 | 'id' => "{$prefix}taxonomy", 345 | 'type' => 'taxonomy', 346 | // Taxonomy name 347 | 'taxonomy' => 'category', 348 | // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional 349 | 'field_type' => 'select_tree', 350 | // 'inline' => false, 351 | // Additional arguments for get_terms() function. Optional 352 | 'query_args' => array(), 353 | ), 354 | // TAXONOMY ADVANCED 355 | array( 356 | 'name' => esc_html__( 'Taxonomy Advanced', 'textdomain' ), 357 | 'id' => "{$prefix}taxonomy_advanced", 358 | 'type' => 'taxonomy_advanced', 359 | 360 | // Can this be cloned? 361 | 'clone' => true, 362 | 363 | // Taxonomy name 364 | 'taxonomy' => 'category', 365 | 366 | // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional 367 | 'field_type' => 'select_tree', 368 | 369 | // Additional arguments for get_terms() function. Optional 370 | 'query_args' => array(), 371 | ), 372 | // POST 373 | array( 374 | 'name' => esc_html__( 'Posts (Pages)', 'textdomain' ), 375 | 'id' => "{$prefix}pages", 376 | 'type' => 'post', 377 | // Post type 378 | 'post_type' => 'page', 379 | // Field type, either 'select' or 'select_advanced' (default) 380 | 'field_type' => 'select_advanced', 381 | 'placeholder' => esc_html__( 'Select an Item', 'textdomain' ), 382 | // Query arguments (optional). No settings means get all published posts 383 | 'query_args' => array( 384 | 'post_status' => 'publish', 385 | 'posts_per_page' => - 1, 386 | ), 387 | ), 388 | // WYSIWYG/RICH TEXT EDITOR 389 | array( 390 | 'name' => esc_html__( 'WYSIWYG / Rich Text Editor', 'textdomain' ), 391 | 'id' => "{$prefix}wysiwyg", 392 | 'type' => 'wysiwyg', 393 | // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save 394 | 'raw' => false, 395 | 'std' => esc_html__( 'WYSIWYG default value', 'textdomain' ), 396 | 397 | // Editor settings, see wp_editor() function: look4wp.com/wp_editor 398 | 'options' => array( 399 | 'textarea_rows' => 4, 400 | 'teeny' => true, 401 | // 'media_buttons' => false, 402 | ), 403 | ), 404 | // DIVIDER 405 | array( 406 | 'type' => 'divider', 407 | ), 408 | // FILE UPLOAD 409 | array( 410 | 'name' => esc_html__( 'File Upload', 'textdomain' ), 411 | 'id' => "{$prefix}file", 412 | 'type' => 'file', 413 | ), 414 | // FILE ADVANCED (WP 3.5+) 415 | array( 416 | 'name' => esc_html__( 'File Advanced Upload', 'textdomain' ), 417 | 'id' => "{$prefix}file_advanced", 418 | 'type' => 'file_advanced', 419 | 420 | // Delete file from Media Library when remove it from post meta? 421 | // Note: it might affect other posts if you use same file for multiple posts 422 | 'force_delete' => false, 423 | 424 | // Maximum file uploads. 425 | 'max_file_uploads' => 2, 426 | 427 | // File types. 428 | // 'mime_type' => 'application,audio,video', 429 | 430 | // Do not show how many files uploaded/remaining. 431 | 'max_status' => 'false', 432 | ), 433 | array( 434 | 'name' => __( 'Single Image', 'textdomain' ), 435 | 'id' => "{$prefix}single_img", 436 | 'type' => 'single_image', 437 | // 'clone' => true, 438 | ), 439 | // IMAGE ADVANCED - RECOMMENDED 440 | array( 441 | 'name' => esc_html__( 'Image Advanced Upload (Recommended)', 'textdomain' ), 442 | 'id' => "{$prefix}imgadv", 443 | 'type' => 'image_advanced', 444 | 445 | // Delete image from Media Library when remove it from post meta? 446 | // Note: it might affect other posts if you use same image for multiple posts 447 | 'force_delete' => false, 448 | 449 | // Maximum image uploads 450 | 'max_file_uploads' => 2, 451 | 452 | // Display the "Uploaded 1/2 files" status 453 | 'max_status' => true, 454 | 455 | // Image size that displays in the edit page. 456 | 'image_size' => 'thumbnail', 457 | ), 458 | // IMAGE UPLOAD 459 | array( 460 | 'id' => 'image_upload', 461 | 'name' => esc_html__( 'Image Upload', 'textdomain' ), 462 | 'type' => 'image_upload', 463 | 464 | // Delete image from Media Library when remove it from post meta? 465 | // Note: it might affect other posts if you use same image for multiple posts 466 | 'force_delete' => false, 467 | 468 | // Maximum image uploads 469 | 'max_file_uploads' => 2, 470 | 471 | // Display the "Uploaded 1/2 files" status 472 | 'max_status' => true, 473 | ), 474 | // PLUPLOAD IMAGE UPLOAD (ALIAS OF IMAGE UPLOAD) 475 | array( 476 | 'name' => esc_html__( 'Plupload Image (Alias of Image Upload)', 'textdomain' ), 477 | 'id' => "{$prefix}plupload", 478 | 'type' => 'plupload_image', 479 | 480 | // Delete image from Media Library when remove it from post meta? 481 | // Note: it might affect other posts if you use same image for multiple posts 482 | 'force_delete' => false, 483 | 484 | // Maximum image uploads 485 | 'max_file_uploads' => 2, 486 | 487 | // Display the "Uploaded 1/2 files" status 488 | 'max_status' => true, 489 | ), 490 | // IMAGE 491 | array( 492 | 'name' => esc_html__( 'Image Upload', 'textdomain' ), 493 | 'id' => "image", 494 | 'type' => 'image', 495 | 496 | // Delete image from Media Library when remove it from post meta? 497 | // Note: it might affect other posts if you use same image for multiple posts 498 | 'force_delete' => false, 499 | 500 | // Maximum image uploads 501 | // 'max_file_uploads' => 2, 502 | ), 503 | // VIDEO 504 | array( 505 | 'name' => __( 'Video', 'textdomain' ), 506 | 'id' => 'video', 507 | 'type' => 'video', 508 | 509 | // Maximum video uploads. 0 = unlimited. 510 | 'max_file_uploads' => 3, 511 | 512 | // Delete image from Media Library when remove it from post meta? 513 | // Note: it might affect other posts if you use same image for multiple posts 514 | 'force_delete' => false, 515 | 516 | // Display the "Uploaded 1/3 files" status 517 | 'max_status' => true, 518 | ), 519 | // BUTTON 520 | array( 521 | 'type' => 'button', 522 | 'name' => esc_html__( 'Advanced Settings', 'textdomain' ), 523 | // Button text. 524 | 'std' => esc_html__( 'Toggle', 'textdomain' ), 525 | // Custom HTML attributes. 526 | 'attributes' => array( 527 | 'data-section' => 'advanced-section', 528 | 'class' => 'js-toggle', 529 | ), 530 | ), 531 | // TEXT-LIST 532 | array( 533 | 'name' => esc_html__( 'Text List', 'rwmb' ), 534 | 'id' => "{$prefix}text_list", 535 | 'type' => 'text_list', 536 | // Options of inputs, in format 'Placeholder' => 'Label' 537 | 'options' => array( 538 | 'Placehold1' => esc_html__( 'Label1', 'rwmb' ), 539 | 'Placehold2' => esc_html__( 'Label2', 'rwmb' ), 540 | 'Placehold3' => esc_html__( 'Label3', 'rwmb' ), 541 | ), 542 | ), 543 | // Switch 544 | array( 545 | 'type' => 'switch', 546 | 'name' => esc_html__( 'Switch demo', 'textdomain' ), 547 | 'id' => "{$prefix}switch", 548 | // Value can be 0 or 1 549 | 'std' => 1, 550 | // 2 style: rounded and square 551 | 'style' => 'square', 552 | 'on_label' => 'On', 553 | 'off_label' => 'Off', 554 | ), 555 | // Button group 556 | array( 557 | 'name' => esc_html__( 'button group', 'textdomain' ), 558 | 'id' => "button_group", 559 | 'type' => 'button_group', 560 | // Array of 'value' => 'Label' pairs for radio options. 561 | // Note: the 'value' is stored in meta field, not the 'Label' 562 | 'options' => array( 563 | 'value1' => esc_html__( 'Button 1', 'textdomain' ), 564 | 'value2' => esc_html__( 'Button 2', 'textdomain' ), 565 | 'value3' => esc_html__( 'Button 3', 'textdomain' ), 566 | 'value4' => esc_html__( 'Button 4', 'textdomain' ), 567 | 'value5' => esc_html__( 'Button 5', 'textdomain' ), 568 | ), 569 | // style defause wordpress button 570 | 'attributes' => array( 571 | 'class' => 'button', 572 | ), 573 | // Display inline? value : true - false 574 | 'inline' => true, 575 | 576 | // Display multiple? value : true - false 577 | 'multiple' => true, 578 | 'clone' => true, 579 | ), 580 | // background 581 | array( 582 | 'name' => __( 'Background Advanced', 'textdomain' ), 583 | 'id' => 'background_demo', 584 | 'type' => 'background', 585 | ), 586 | ), 587 | ); 588 | 589 | return $meta_boxes; 590 | } 591 | 592 | add_filter( 'rwmb_meta_boxes', 'your_prefix_fieldset_text_demo' ); 593 | function your_prefix_fieldset_text_demo( $meta_boxes ) { 594 | $meta_boxes[] = array( 595 | 'title' => __( 'Fieldset Text Demo', 'textdomain' ), 596 | 'fields' => array( 597 | array( 598 | 'id' => 'fieldset_text', 599 | 'name' => __( 'Fieldset Text', 'textdomain' ), 600 | 'type' => 'fieldset_text', 601 | 602 | // Options: array of Label => key for text boxes 603 | // Note: key is used as key of array of values stored in the database 604 | // Number of options are not limited 605 | 'options' => array( 606 | 'name' => __( 'Name', 'textdomain' ), 607 | 'address' => __( 'Address', 'textdomain' ), 608 | 'email' => __( 'Email', 'textdomain' ), 609 | ), 610 | 611 | // 'clone' => true, 612 | ), 613 | ), 614 | ); 615 | return $meta_boxes; 616 | } 617 | -------------------------------------------------------------------------------- /general/force-delete.php: -------------------------------------------------------------------------------- 1 | __( 'Test Meta Box', 'textdomain' ), 8 | 'fields' => array( 9 | // FILE UPLOAD 10 | array( 11 | 'name' => __( 'File Upload', 'textdomain' ), 12 | 'id' => "{$prefix}file", 13 | 'type' => 'file', 14 | 'force_delete' => true, 15 | ), 16 | // IMAGE UPLOAD 17 | array( 18 | 'name' => __( 'Image Upload', 'textdomain' ), 19 | 'id' => "{$prefix}image", 20 | 'type' => 'image', 21 | ), 22 | // PLUPLOAD IMAGE UPLOAD (WP 3.3+) 23 | array( 24 | 'name' => __( 'Plupload Image Upload', 'textdomain' ), 25 | 'id' => "{$prefix}plupload", 26 | 'type' => 'plupload_image', 27 | 'max_file_uploads' => 4, 28 | 'force_delete' => true, 29 | ), 30 | ), 31 | ); 32 | 33 | return $meta_boxes; 34 | } 35 | -------------------------------------------------------------------------------- /general/media-modal.php: -------------------------------------------------------------------------------- 1 | esc_html__( 'Standard Fields', 'textdomain' ), 12 | 13 | 'post_types' => 'attachment', // Must set to 'attachment' or contains 'attachment'. 14 | 'media_modal' => true, // Must set to true. 15 | 16 | 'fields' => array( 17 | array( 18 | 'name' => esc_html__( 'Text', 'textdomain' ), 19 | 'id' => "{$prefix}text", 20 | 'type' => 'text', 21 | ), 22 | array( 23 | 'name' => esc_html__( 'Checkbox', 'textdomain' ), 24 | 'id' => "{$prefix}checkbox", 25 | 'type' => 'checkbox', 26 | ), 27 | array( 28 | 'name' => esc_html__( 'Radio', 'textdomain' ), 29 | 'id' => "{$prefix}radio", 30 | 'type' => 'radio', 31 | 'options' => array( 32 | 'value1' => esc_html__( 'Label1', 'textdomain' ), 33 | 'value2' => esc_html__( 'Label2', 'textdomain' ), 34 | ), 35 | ), 36 | array( 37 | 'name' => esc_html__( 'Select', 'textdomain' ), 38 | 'id' => "{$prefix}select", 39 | 'type' => 'select', 40 | 'options' => array( 41 | 'value1' => esc_html__( 'Label1', 'textdomain' ), 42 | 'value2' => esc_html__( 'Label2', 'textdomain' ), 43 | ), 44 | ), 45 | array( 46 | 'name' => esc_html__( 'Textarea', 'textdomain' ), 47 | 'id' => "{$prefix}textarea", 48 | 'type' => 'textarea', 49 | ), 50 | ), 51 | ); 52 | 53 | return $meta_boxes; 54 | } ); 55 | -------------------------------------------------------------------------------- /integration/add-user-meta-to-wc-pip-invoices.php: -------------------------------------------------------------------------------- 1 | get_user_id(); 10 | if ( ! $user_id ) { 11 | return; 12 | } 13 | 14 | $args = [ 15 | 'object_type' => 'user', 16 | 'storage_type' => 'custom_table', 17 | 'table' => 'creaktor_users', 18 | ]; 19 | 20 | // For billing VAT number. 21 | $billing_vat_number = rwmb_meta( 'user_billing_vat_number', $args, $user_id ); 22 | echo $billing_vat_number; 23 | 24 | // For shipping VAT number. 25 | $shipping_vat_number = rwmb_meta( 'user_shipping_vat_number', $args, $user_id ); 26 | echo $shipping_vat_number; 27 | } 28 | 29 | add_action( 'wc_pip_after_customer_addresses', 'mb_add_user_meta_to_wc_pip_invoices', 10, 4 ); 30 | -------------------------------------------------------------------------------- /integration/caldera-forms.php: -------------------------------------------------------------------------------- 1 | $form ): 26 | // admin-metabox-append-a-form.html.php 27 | $id = $form_id; 28 | $key[] = $form_id; 29 | $value[] = $form['name']; 30 | endforeach; 31 | $option = array_combine($key, $value); 32 | } else { 33 | $option = array('no_forms' => 'ACTIVATE CALDERA FORM PLUGIN!!'); 34 | } 35 | 36 | array( 37 | 'name' => 'Caldera Form Select', 38 | 'id' => "{$prefix}caldera_form", 39 | 'type' => 'select_advanced', 40 | 'options' => $option, 41 | 'multiple' => false, 42 | 'placeholder' => 'Select a Form', 43 | ), 44 | 45 | // Other meta boxes go here 46 | return $meta_boxes; 47 | } 48 | -------------------------------------------------------------------------------- /integration/contact-form-7.php: -------------------------------------------------------------------------------- 1 | 'Select the form', 20 | 'id' => "{$prefix}contact_form", 21 | 'type' => 'post', 22 | 'post_type' => 'wpcf7_contact_form', // Contact form 7's post type 23 | 'field_type' => 'select_advanced', 24 | 'placeholder' => 'Select an Item', 25 | 'query_args' => array( 26 | 'post_status' => 'publish', 27 | 'posts_per_page' => - 1, 28 | 'orderby' => 'title', 29 | 'order' => 'ASC', 30 | ), 31 | ), 32 | // Other meta boxes go here 33 | return $meta_boxes; 34 | } 35 | -------------------------------------------------------------------------------- /integration/gravity-forms.php: -------------------------------------------------------------------------------- 1 | id ); 28 | $value[] = esc_html( $form->title ); 29 | endforeach; 30 | $option = array_combine($key, $value); 31 | } else { 32 | $option = array('no_forms' => 'ACTIVATE GRAVITY FORM PLUGIN!!'); 33 | } 34 | 35 | 36 | array( 37 | 'name' => 'Gravity Form Select', 38 | 'id' => "{$prefix}gravity_form", 39 | 'type' => 'select_advanced', 40 | 'options' => $option, 41 | 'multiple' => false, 42 | 'placeholder' => 'Select a Form', 43 | ), 44 | 45 | // Other meta boxes go here 46 | return $meta_boxes; 47 | } 48 | -------------------------------------------------------------------------------- /integration/ninja-forms.php: -------------------------------------------------------------------------------- 1 | form()->get_forms(); 24 | $key = array(); 25 | $value = array(); 26 | foreach( $forms as $form ): 27 | $id = $form->get_id(); 28 | $key[] = intval( $id ); 29 | $value[] = esc_html( $form->get_setting( 'title' ) ) . ' [id:' . intval( $id ) . ']'; 30 | endforeach; 31 | $option = array_combine($key, $value); 32 | } else { 33 | // Otherwise include cta 34 | $option = array('' => 'ACTIVATE NINJA FORM PLUGIN!!'); 35 | } 36 | 37 | array( 38 | 'name' => 'Select', 39 | 'id' => "{$prefix}ninja_form", 40 | 'type' => 'select_advanced', 41 | 'options' => $option, 42 | 'multiple' => false, 43 | 'placeholder' => 'Select a Form', 44 | ), 45 | 46 | // Other meta boxes go here 47 | return $meta_boxes; 48 | } 49 | -------------------------------------------------------------------------------- /integration/relevanssi.php: -------------------------------------------------------------------------------- 1 | post_type == "your_post_type") { 5 | $files = rwmb_meta( '_your_meta_file_advanced' ); 6 | foreach ( $files as $file ) { 7 | $content .= ' ' . $file['title']; 8 | } 9 | } 10 | return $content; 11 | } 12 | --------------------------------------------------------------------------------