wpmetabox / meta-box Goto Github PK
View Code? Open in Web Editor NEWThe best plugin for WordPress custom fields and custom meta boxes
Home Page: https://metabox.io
The best plugin for WordPress custom fields and custom meta boxes
Home Page: https://metabox.io
Noticed this while testing the demo file. By having the add_action function there, you call the end_html filter twice, the secondof which accidentally passes along $meta as the wrong argument and displays the meta as the desc.
Currently we got jQuery 1.7 in WP Core
jQuery official documentation says, that we should now start using .on()
instead.
Any ideas on this one?
People love images and prefer them over reading :P
We should add a screenshot folder and drop some default images for every input field in there. Discussion: Predefine look - drop shadow, border (-color), textsize, etc.
Currently we got [1], where
We already had [2], where
Now I see the reducement in code complexity + lines from my version to @rilwis improvements (a.k.a. the current version).
Could we go one step further and try to get the best from both worlds? This is no call to code, but more a "what would be the smartest way to extend the current solution for a better UX?".
[1] The new interface [2] The first versionHello,
Probably I'm overlooking something, but after adding a new taxonomy/category it isn't getting shown/updated in the post editor?
As far as I know, this should work?
array( 'name' => 'Taxonomies', 'id' => $prefix . 'mogelijkheid', 'type' => 'taxonomy', // File type: taxonomy 'options' => array( 'taxonomy' => 'mogelijkheden', // Taxonomy name 'type' => 'checkbox_list', // How to show taxonomy: 'checkbox_list' (default) or 'select'. Optional 'args' => array( ), // Additional arguments for get_terms() function ), 'desc' => 'Choose One Taxonomy' )
Could you tell what I might be overlooking perhaps?
I've created custom taxonomy called Models and made it hierarchical so I can add Car brands, models and versions there and keep their relations, like this:
-Ford
--Mustang
---Cobra
-Ferrari
-- 308
--- GTS
Problem is, this list might get pretty long and only one brand, one model and one version is needed per post, so checkboxes are misleading.
I'm thinking to split that metabox in to three (one for brand, one for model and another for version) and make them dropdowns. So when brand is selected in the first dropdown, second dropdown would show only models related to that brand, and the same for version. But i have no idea how to code it. Maybe anyone could show me an example?
Thanks!
For some reason I run into a 403 when trying to rebase my fork from master @rilwis
Anybody got the same problem?
Hi there,
I was wondering if it was possible to add the meta box only to one specific page ?
Thanks in advance for your time.
Great code by the way.
Jk_
As the title says, I'm searching for a nice way - that works for all core field classes - to dismiss the label if the name attribute is not set or empty.
Currently I'm thinking about a helper function to check this and - if it's the case - override the $html
with the beginn_{$field['id']}_html
filter.
What's your thoughts?
It looks like I'm locked out from adding pages to the wiki... Just wanted to write a guide on how to customize Plupload, like seen here.
Hello,
Using Firefox only there's an empty block below the admin footer when posting/editing a post/page, which seems to be caused by the jQuery date/timepicker.: http://cl.ly/1t2K0x1U3R001B0H0b2K.
(the screenshot is made using another meta-box plugin, but the bug is the same)
Not entirely sure, but reading from that other topic switching to WordPress' core UI might do the trick.
Instead of the "Error"-image I get an error inside an alert()
box from the ajax callback, that gets triggered from /inc/file.php
.
Hi! I think ther's a problem when saving data from a custom meta in the page
i've used this code:
$meta_boxes[] = array(
'id' => 'lastm_users',
'title' => 'Crea la Pagina Utente',
'pages' => array('page', 'post'),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'name' => 'Nome Utente Schedahotel',
'id' => $prefix . 'little_author',
'type' => 'select',
'options' => $myusersid,
'std' => ''
),
array(
'name' => 'Località Categoria',
'id' => $prefix . 'little_catego',
'type' => 'taxonomy',
'options' => array(
'taxonomy' => 'luogolastminute',
'type' => 'select',
'args' => array()
),
'desc' => 'Scegli il luogo da associare'
)
)
);
I have a prefix 'pv_'
When i call in my page with that function: get_post_meta($post->ID, 'pv_little_catego', true);
Display nothing
Hi Rilwis, first I'd like to thank you for this wonderful script.
Sometimes you need to customize the metabox a little further. It happened to me several times and I had to add the metabox outside the class, with the add_meta_box function. So why not include a callback function to display some custom code into the metabox, or at least before/after the input? I think it might be an all-round solution.
Looking forward to see updates! Thanks again.
This is a bug reported by another person:
However, when someone chooses a WYSIWYG field, it displays incorrectly if there is a hyphen or underscore in $field['id'], because the wp_editor function does not accept anything but lowercase letters for the editor ID.
This is how I fixed it:
$editorid=str_replace("-","",$field['id']);
wp_editor($meta, $editorid, array('textarea_name'=>$field['id'],'editor_class' => 'rwmb wysiwyg'));
Of course, this only removes hyphens to make the display correct. The script should also replace underscores, other special characters, and convert uppercase characters to lowercase. (I haven't had time to work on that yet.) However, it still passes the $field['id'] value as the name of the text area, which will allow the information in the box to be saved with that ID.
Just updated to version 4.0.2 and unfortunately that gave me the white screen of death. Reverting back to 4.0.1 didn't solve it however and deleting the plugin also didn't help.
The only thing that worked, was to delete the demo.php from my theme. I have given this demo.php file a different name (sl_metaboxes.php) and added it to the includes folder of my theme. In my functions.php file I have called it as:
// Include Metaboxes script
include 'includes/sl_metaboxes.php';
My error log says the following:
[21-Dec-2011 07:48:48] PHP Fatal error: Class 'RW_Meta_Box' not found in /.../.../public_html/domain/wp-content/themes/salt2011/includes/sl_metaboxes.php on line 145
Line 145 calls this:
143: // Register meta boxes
144: foreach ( $meta_boxes as $meta_box ) {
145: new RW_Meta_Box( $meta_box );
146: }
Now what I don't understand is that version 4.0.1 worked with my setup, but after updating to 4.0.2 and then downgrading back to 4.0.1 it doesn't work anymore.
I have temporarily deleted the sl_metaboxes.php file, but if we cannot find a solution soon, I will have to revert back to the old hard-coded script instead of the plugin.
Looking forward to hear other experiences and hopefully a solution.
Thanks,
Piet
Hey there,
just tried to create a taxonomy field with cloning functionality.
The cloning UI does appear and work, but only the last value is being saved.
The only workaround right now is to create a select box with the category list as options.
Cheers
When I use Meta Boxes in Multi site Wordpress blog.,
my blog often crash when i ty to deactive the plugin.
Someones reported that. Haven't tested and fixed!
WordPress 3.3 has a new media uploader incorporating drag and drop.
Can this be incorporated into the new script?
Perhaps attaching images like a featured/thumbnail image also so a single image can be used across multiple posts/pages. As currently once an image is attached with the meta box uploader it cannot be used on any other post or page.
There's a strange error with the taxonomy field (checkbox_list or select) the output is always empty, if i change the $prefix the selected values are still there only for that field, when i check another post or page that includes that option , a random checkbox is selected on each post or page even if the post was not saved with those options.
I'm using the default code (no changes) and the code is inside my plugins folder. i'm not sure if i'm doing something wrong.
So far (with a fresh download), I can't delete files anymore. I constantly get the alert()
in my local install. I wasn't able to debug this one.
is it possible?
'pages' => array( 'post_format', 'gallery' ),
In version 3.2.2 at line 226 the function show() checks if a custom field has any value: if not, it declares the default value. See:
$meta = ($meta !== ”) ? $meta : $field['std'];
But when a checkbox is unchecked, no data is saved and the next time the field gets loaded, it gets the standard value. If the default value is 1, true, ‘on’ or ‘checked’ an unchecked checkbox always automatically gets checked again!
A solution might be to always save a value, also when a checkbox is unchecked. Like FALSE, 0 or ‘off’…
In general inline styles are never necessary, so we should remove the one for checkbox tree form field over here in demo.php and get the stuff into the css file.
I just tried using this plugin in my mu-plugins directory and Wordpress couldn't find it.
what happended to the thickbox upload that we had in the old versions??
ive just updated and just get a file input with options to add more????
the old version was better, whats happened
This meta-box class is my favourite! It's well maintained and easy to use, without a bloaty UI.
I would love to have an option of making fields repeatable.
@rilwis @funkedgeek
I added a branch settings_page to my fork.
You will have to take a look at /root/settings_page.php
and add /root/demo/demo-settings_page.php
.
To run the demo, you need to add
include_once RWMB_DIR.'demo/demo-settings_page.php'; include_once RWMB_DIR.'settings_page.php';
List of things that are tested & work:
RW_Meta_Box_Settings_Page::show();
line 120$page_hook
, capability for the settings pageList of things that don't work:
'side'
contextList of things to come:
Here's the "funny" thing: When inspecting the meta boxes, you see that they're registered and should appear. Go down to Line 190 in settings_page.php and uncomment the debug function. Then you see that everything seems to be right. I simply got no idea (and no more time) of what's wrong around here.
I would appreciate if you could take a look
Hey,
I created a simple thickbox image uploader. It's a hack based on the current image.php/js and it's everything else than a perfect solution. It's just a quick hack which works for my project. It has a few drawbacks:
I uploaded the image.php and image.js files @MediaFire. Maybe it helps some other users. You just need to replace the original files and call the post_meta value with "true" instead of "false".
http://www.mediafire.com/?xx6q4xr859ng156
http://www.mediafire.com/?1anljf17ayk1bq9
Regards,
thezuberat
After reading this idea from Aron Jorbin, I think we could add this as input argument too.
We really need type="hidden" and disabled fields
Someone has reported the problem with translation (to Italian):
In the po file some string are double (i.e. : delete, Upload file); i have translated but why double? And... the mo file don't work; as you see in the zip file , i have set the name of the file as rwmb-it_IT.mo because in the meta-box.php (line 125) the mo file in
$l18n_file = "{$dir}/{$domain}-{$GLOBALS['locale']}.mo";
with at line 30
define( 'RWMB_TEXTDOMAIN', 'rwmb' );
but the italian translation don't work.
Hello,
Would it be possible to have this added to the style.css
?
.rwmb-textarea { resize: vertical; }
Hey guys-
I'm trying to include version 4.1 into my theme and have followed your instructions in the wiki on how to do that. I downloaded the master zip file from here.
To verify that I am doing it correctly, here's a screenshot: http://cl.ly/D9bo
I pasted the code from demo.php into the config-meta-boxes.php. Here's a screenshot of what it looks like in the post editor: http://cl.ly/D9gh
I'm not getting any debugging errors from Wordpress, and I'm running 3.3.1. Any help would be appreciated.
Just got a note from Frank about file type restriction for the uploader. Looks good and would make the meta box much better. Maybe we should try to make the move so only configure file
and types => array( /*...*/ )
?
Been looking and personally i dont like the creamy ui chosen for the latest plugin version of the class. i still love the class though.
after looking at the code there is no way to filter it without touching core code.
can an option to choose custom ui theme be added to the next release?
A wysiwyg within a meta box although saying the text is in a p tag, its not actually once its printed front end.
Bold tags work, as do others but the initial P tag does not.
Kind of making having the wysiwyg there a bit pointless?
Anyone else have this issue or just me?
The uploaded images and upload new images is not really working.
The add more file just jumps you to the top of the page and you cannot delete an existing file after you have uploaded just the one..
The meta-box is installed via the theme not the plugin and is running on WordPress 3.3 Release Candidate 1
Is this just waiting for WordPress 3.3 to be officially released to be fixed or....?
Hello,
Having just upgraded to the latest release I'm now receiving this error having the WP debug mode enabled: Notice: Undefined index: class in /meta-box.php on line 222
.
I get the following error at the top of the first 'Personal Information' Meta Box, when both used as a plugin and not.....
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home//public_html/colTest/wp-content/themes/test/meta-boxes/meta-box-test/demo/demo.php on line 73
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home//public_html/colTest/wp-content/themes/test/meta-boxes/meta-box-test/demo/demo.php on line 73
Tinymce wysiwyg editor also doesn't show in WordPress 3.3 beta 2.
Currently do_field_class_actions
always saves an array
, due to $args[] = $field
. This is a little bit annoying, as it successfully prevents meta queries. We need to add a single_value
argument.
Does this new version include Manny's advanced meta box class?
I take it we can still just include in a theme rather than as a plugin?
We're missing cols
and rows
input/definition arguments for the textarea form field. Exactly here in demo.php we're even teaching people to use inline styles (which imho is bad). On the other hand: We can put the style definition there as it won't do anything - the arguemnt simply isn't taken.
I’m using the ‘file’ type to upload a single file. However the admin area enables the user to upload many files instead. Could you perhaps add a different type for multiple files (e.g. ‘files’) or something like how many files you would like the user to upload?
Something like:
‘type’ => ‘file’ // Field type: file upload
‘number_of_files’ => 1 // Number of files a user can upload, use ’0′ for infinite.
The reason is that enabling multiple file uploads could lead to expectations in the front-end and possible problems with retrieving the single (first file) in the list. Also I prefer to have my end-user get as clean an interface as possible.
We should really use the built in Walker
class (/wp-includes/class-wp-walker.php) instead of walk_checkbox_tree()
if possible. Else it's imho a bad practice example :)
Hello,
Perhaps I'm overlooking something somewhere, but when using the default demo.php
I've somehow lost all rich/wysiwyg editor buttons.
Edit:
It seems I've also lost the edit-slug box
Screenshot: http://d.pr/60W
Hello, i try to get an option with select or checkbox list with published pages, but i don't know how make them... i try use a new class, but i can't make to work, do you can help me?
thank you very much for your time.
// show pages list
function show_field_pages($field, $meta) {
global $post;
if (!is_array($meta)) $meta = (array) $meta;
$this->show_field_begin($field, $meta);
$options = $field['options'];
$pages = get_pages($options['args']);
// checkbox_list
if ('checkbox_list' == $options['type']) {
foreach ($pages as $page) {
echo "<input type='checkbox' name='{$field['id']}[]' value='$page->ID'" . checked(in_array($page->ID, $meta), true, false) . " /> $page->name<br/>";
}
}
// select
else {
echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
foreach ($pages as $page) {
echo "<option value='$page->ID'" . selected(in_array($page->ID, $meta), true, false) . ">$page->post_title</option>";
}
echo "</select>";
}
$this->show_field_end($field, $meta);
}
// show posts list
function show_field_posts($field, $meta) {
global $post;
if (!is_array($meta)) $meta = (array) $meta;
$this->show_field_begin($field, $meta);
$options = $field['options'];
$posts = get_posts($options['args']);
// checkbox_list
if ('checkbox_list' == $options['type']) {
foreach ($posts as $post) {
echo "<input type='checkbox' name='{$field['id']}[]' value='$post->ID'" . checked(in_array($post->ID, $meta), true, false) . " /> $post->name<br/>";
}
}
// select
else {
echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
foreach ($posts as $post) {
echo "<option value='$post->ID'" . selected(in_array($post->ID, $meta), true, false) . ">$post->post_title</option>";
}
echo "</select>";
}
$this->show_field_end($field, $meta);
}
Using the demo code and I'm getting an issue: the meta boxes seem to be overlaping each other. Looks like it might be a CSS issue but the how or why I have no clue. Examples are http://watchonepiecelegally.com/meta_box_plugin_css_overlap.jpg and http://watchonepiecelegally.com/meta_box_plugin_css_overlap2.jpg
Version of WordPress is the latest (3.3).
How can I replace the Canvas loader introduced in the last update? I want use the spin.js (http://fgnass.github.com/spin.js) since I'm already using it in my project.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.