Hey! I want to be able to add additional text to the GUI such as notes to show people what to enter and titles for different sections.. like some custom fields are only used on certain categories so I’d like to be able to divide them up..
Something like:
Header = Article Info:
[By-Line]
type = textfield
instruction = enter the author of the article.
[Image URL]
type = textfield
instruction = enter the URL for the image.
[Image Thumb URL]
type = textfield
instruction = enter the URL for the thumbnail.
Header = Review Info
[Rating]
type = select
value = 1 # 2 # 3 # 4 # 5
instruction = select a rating from 1-5.
I’d be happy to do the work but any idea where I’d have to start. I know very little about writing plugins.
Awesome plugin. Thank you, I really appreciate it. I might extend this if thats cool with you (i.e. display options if certains options above are activated)…
Nice plugin. Really useful, the default system from WP2.0 sux. I am creating kind of picture data base using WP, I enter the pictures as posts but I needed a way to separate the information provided by the author from the picture, now with your plugin is easier, I put the url of every picture as a metadata in just a moment.
Thanks a lot!
By the way, maybe will be interesting a field to give the size of the textbox, too short for me, and also the tip text as somebody said before.
How can I tweak it to allow selection of multiple items?
Cheers
3stripe
3stripes,
You could make multiple checkboxes
I love this plug-in. I was wondering if anyone had figured out Jonathan’s dilemna (having it appear on the “Write Page”.
Cheers,
iso
Is there anyway I could make a dropdown menu that you could select multiple options from?
Dont really want to add 15 checkboxes!
Thanx
3stripe
Very nice plugin.
I wish there is a way for the plugin to get the data for the
select and checkboxes from the database, instead of hardcoding in the ini file. Some of my posts need to choose a meta datavalue from a “pool” of values.
Excellent work mate..thx alot for the great plug..
cheers
Indy
Hi,
This probably seems like a dumb question but–
What is the meta tag that is set by this plugin?
I can put fields into the Post page, but I can’t output them if I don’t know what to put into get_post_meta($post_id, $key, $single);
Josh P,
They’re the same as what you have in the conf.ini. The sample conf.ini, for example, will have post metas of Plan, Favorite Post, Miles Walked, etc.
Hey – I can report that the plugin works under 2.0.2 as well, at least for me.
Also, I needed to put some of the gui-based settings under “Capability” control, using the 2.0 concept of roles, and the “Role Manager” plugin.
To accomplish this, I added “global $current_user” to the top of the insert_gui() function, and the following lines to the top of the “foreach( $fields as $title => $data ) {” loop inside that function:
/* roles stuff added by reed */
if ( $data[‘capability’] ) {
$capability = $data[‘capability’];
if (!$current_user->has_cap($capability)) {
continue;
}
}
It works great; you just add a line like:
capability=”alter_meta_data”
to the conf.ini file, and only users with that capability will get the widgets associated with that setting.
Of course, they could still go and edit the metadata manually elsewhere on the edit page, but my users are all assumed to have good intentions; this is just to help them avoid confusion.
Thanks for a nice plugin!
Hey There,
It is now possible to use this plugin for PAGES as well as POSTS.
In order to make it work for pages:
All you have to do is add this line somewhere below the “include once” line in rc-custom-field-gui.php:
I would like to be able to write in a custom field an url something. Now it’s not working using url, maybe because of ” maybe because of
I haven’t looked but most likely it’s because WP filters html tag in custom field, which in your case is a href tag. What you can do is have the custom field take the url only (say, http://mysite.com) and then when you retrieve the value of the custom fields, you could construct the html link tag.
I think I have the same or similar problem as in Comment 22. If I add a double-quotation mark into a text field, the fields don’t redisplay properly. Instead, whatever follows the first double-quote gets placed outside the text box. It has to do with the $value variable in rc-custom-field-gui.class.php, but I’m not sure how to work around it within the code. If I use single-quotes in the text field, that works, but I’d rather use doubles because I use css classes and urls. Very nice plug-in, however. Thanks for sharing it.
I’m also having problems with HTML link as meta values. It works fine when adding them through standard WP interface, but the plugin mangles them… single quotes don’t work for me either…
The solution Joshua had given me was to put htmlentities() around the $value variable in rc-custom-field-gui.class.php. It’s around line 33 for the text input field.
Just thought you might be itnerested to know I’ve extended this a bit to add the header and instructions as suggested by me a while ago.. I can’t believe how easy it was! :) Thanks.
Interesting site. Useful information. Bookmarked.
Ok I’m really new at this so I’m sure this is a stupid question. I made my custom post form but I can’t get the results to display with the post. Anyway you can help me?
I’ve added a multiple select to my version – however I am having problems with it in WP2. It works fine in wp1.5, but if I have more than 5 custom fields in wp2, it overwrites the fifth one over and over until it is the same as the last one.. and some disappear.
actually the bug is different – it doesn’t let me have more than one field in the conf.ini with the same key..
what I wanted to do was a select with multiple options, but if an option wasn’t there a text box to set a customfield to that key also..
so my conf.ini is (excluding a few additions I’ve added to the code, but that won’t effect this problem).
it only shows the text field and not the select.. or the other way around if I list them in the opposite order.. any reason why?
Lellie,
You can’t have duplicate keys. I have to do major re-coding to support that. What you can do is to have key “sizes” and “custom size”. And when you display the meta, you check if there’s value for “custom size.” If there is than you display it; otherwise, display value from “sizes.”
Thanks joshua – yeah I’ve been looking at that and it doesn’t seem to like it.. I was looking at the code and decided it wasn’t worth the effort to change. I was thinking I’ll just have to change the key to “additional sizes” or similar..
Do you want my editted version btw – I’ve added a few new features.
1 new feature allows me to define in the conf.ini
[Header Text]
type=header
desc = Whatever I want to write under the header
[Another Smaller Header]
type=header2
desc = more explanatory text..
which produces a and respectively using the key text as header text and the description is put underneath as some explanation of the section. This is useful if you have a number of custom fields like I do – some which are for different types of story – so I’ve put a main header at the top of all the custom fields, and then smaller headers under each section (such as gigs, albums, books, films).
I’ve also added a “help” line to *all* the different form types which you can enter some text into and when you view the form you see a little help icon with some tooltip text.
Lastly I’ve added a multiple select item. Which you define some values to and you can now select multiple items from the list and it will take the array produced and save each one individually as custom fields..
bugger it stripped my html
“which produces a and respectively that should read.
still doesn’t like it.. that’s a h2 and h3.. :p
ooo gone further now..
I thought I might have more than one additional size and didn’t want to add 3 or 4 textfield options.
So I’ve now added a textarealist which allows you to type in multiple values on new lines – it then adds them as individual custom fields with the same key.
The only thing I can’t get is the GUI on the edit page for either the multiple select or this new textarealist to remember all of the entered values – it only selects the last one (or reenters the last one).. which isn’t the end of the world, but could be vastly improved.. I presume I need to edit the isset function, but any ideas how?
I got the plug to work and it is awesome. Your plugin made me think of a quick question that you might be able to answer. Is there a way to have static information appear on every post an author is going fill out? I want to make it so directions on how to fill out a post is on the post itself. Right now I’m cheating and just using your pluging and putting the directions next to a check box.
I’ve installed this on a 2.0.4 site and can’t seem to get it to work. Anyone else having trouble with this?
Re Jason’s comment 22.
I have tried to add the this Form functionality to PAGES as well as POSTS exactly as you described in your code example. I get the fields appearing in the admin backend, but the content won’t display on the live PAGES.
I added this line of code in ‘rc-custom-field-gui.php’ which now looks like this:
and have added the following code to my file in: themes/default/index.php
If you can help me it would be very appreciated!
tim0fee
php the_meta();Â
(obviously within the php tags!)
Localization?
I’ve tried with accented vowels, both staight and HTML encoded in a select dropdown list and it breaks the input list. Any idea or approach?
BTW, thx for the plugin. I avoided Drupal complexity once again. ;-)
Have a good day,
hip
I found a ‘patch’ (say ammending) to the localization problem above.
In the rc_custom_field_gui.class.php there’re the functions echoing the form input fields (input(text), input(radio), textarea,…). Wrapping the (echoed) values in these functions with ‘htmlentities()’ does the trick.
I believe it doesn’t harm any of the english characters at all and let’s us (the ones developing in other languages than english) make use of a wider range of characters. I believe the plugin won’t have any issue because of these changes but I haven’t tested it yet.
Hope it helps.
Have a good day,
hip
I’m getting this error message – perhaps because I changed the conf.ini after having used it once. Anyway, deactivated, deleted the plugin and reinstaled but I get this error:
[You have an error in your SQL syntax near ‘t go if…” at line 1]
SELECT meta_value FROM wp_postmeta WHERE post_id = ’13’ AND meta_key = ‘Don’t go if…’
Maybe I need to clean the database?
Many thanks. Potentially a terrific plug. Are you not still developing it.
PS WordPress 2.04
Nigel, You cant have ‘ in your field names.
Joshua, is it possible to hook up a field with the wysiwyg-editor?
Johannes,
Can you elaborate on that?
In conf.ini is “type” equivalent to “key” in the original wp add a new custom field section?
Also…
I usually have 5 custom fields, 4 “enclosure” and 1 “thumbnail”. The 4 enclosure fields are each 5 lines long where the first 2 lines change daily, but the last 3 are always the same. I am trying to figure out how to make this work, but am kind of new to this and am not even sure I can do this with what you have done.
I may have posted a comment in the wrong place but…
can you make this plugin work for PAGES too as well as posts? It doesn’t seem to work on PAGES yet…. THANKS!
Pingback: The Bitwise Operator » Wordpress Integration
Hey! I want to be able to add additional text to the GUI such as notes to show people what to enter and titles for different sections.. like some custom fields are only used on certain categories so I’d like to be able to divide them up..
Something like:
Header = Article Info:
[By-Line]
type = textfield
instruction = enter the author of the article.
[Image URL]
type = textfield
instruction = enter the URL for the image.
[Image Thumb URL]
type = textfield
instruction = enter the URL for the thumbnail.
Header = Review Info
[Rating]
type = select
value = 1 # 2 # 3 # 4 # 5
instruction = select a rating from 1-5.
I’d be happy to do the work but any idea where I’d have to start. I know very little about writing plugins.
Awesome plugin. Thank you, I really appreciate it. I might extend this if thats cool with you (i.e. display options if certains options above are activated)…
Chase,
Feel free to do that.
Pingback: Blogalistic » Rhymed Code » Custom Field GUI
Pingback: Rocky Lam » Blog Archive » Wordpress Goodies
Pingback: Chris Jensen » Towards a Publications Page
Nice plugin. Really useful, the default system from WP2.0 sux. I am creating kind of picture data base using WP, I enter the pictures as posts but I needed a way to separate the information provided by the author from the picture, now with your plugin is easier, I put the url of every picture as a metadata in just a moment.
Thanks a lot!
By the way, maybe will be interesting a field to give the size of the textbox, too short for me, and also the tip text as somebody said before.
If you want to check the site (its in spanish): http://herguina.tamats.com
tarnat,
See post #14 in this section.
Pingback: El blog de Tamat » Blog Archive » Creando una web con Wordpress
Cool!
How can I tweak it to allow selection of multiple items?
Cheers
3stripe
3stripes,
You could make multiple checkboxes
I love this plug-in. I was wondering if anyone had figured out Jonathan’s dilemna (having it appear on the “Write Page”.
Cheers,
iso
Is there anyway I could make a dropdown menu that you could select multiple options from?
Dont really want to add 15 checkboxes!
Thanx
3stripe
Very nice plugin.
I wish there is a way for the plugin to get the data for the
select and checkboxes from the database, instead of hardcoding in the ini file. Some of my posts need to choose a meta datavalue from a “pool” of values.
Excellent work mate..thx alot for the great plug..
cheers
Indy
Hi,
This probably seems like a dumb question but–
What is the meta tag that is set by this plugin?
I can put fields into the Post page, but I can’t output them if I don’t know what to put into get_post_meta($post_id, $key, $single);
Josh P,
They’re the same as what you have in the conf.ini. The sample conf.ini, for example, will have post metas of Plan, Favorite Post, Miles Walked, etc.
Hey – I can report that the plugin works under 2.0.2 as well, at least for me.
Also, I needed to put some of the gui-based settings under “Capability” control, using the 2.0 concept of roles, and the “Role Manager” plugin.
To accomplish this, I added “global $current_user” to the top of the insert_gui() function, and the following lines to the top of the “foreach( $fields as $title => $data ) {” loop inside that function:
/* roles stuff added by reed */
if ( $data[‘capability’] ) {
$capability = $data[‘capability’];
if (!$current_user->has_cap($capability)) {
continue;
}
}
It works great; you just add a line like:
capability=”alter_meta_data”
to the conf.ini file, and only users with that capability will get the widgets associated with that setting.
Of course, they could still go and edit the metadata manually elsewhere on the edit page, but my users are all assumed to have good intentions; this is just to help them avoid confusion.
Thanks for a nice plugin!
Hey There,
It is now possible to use this plugin for PAGES as well as POSTS.
In order to make it work for pages:
All you have to do is add this line somewhere below the “include once” line in rc-custom-field-gui.php:
add_action( ‘edit_page_form’, array( ‘rc_custom_field_gui’,
‘insert_gui’ ) );
I just tried it on 2.0.2 and it worked great.
I would like to be able to write in a custom field an url something. Now it’s not working using url, maybe because of ” maybe because of
I haven’t looked but most likely it’s because WP filters html tag in custom field, which in your case is a href tag. What you can do is have the custom field take the url only (say, http://mysite.com) and then when you retrieve the value of the custom fields, you could construct the html link tag.
I think I have the same or similar problem as in Comment 22. If I add a double-quotation mark into a text field, the fields don’t redisplay properly. Instead, whatever follows the first double-quote gets placed outside the text box. It has to do with the
$value
variable in rc-custom-field-gui.class.php, but I’m not sure how to work around it within the code. If I use single-quotes in the text field, that works, but I’d rather use doubles because I use css classes and urls. Very nice plug-in, however. Thanks for sharing it.I’m also having problems with HTML link as meta values. It works fine when adding them through standard WP interface, but the plugin mangles them… single quotes don’t work for me either…
The solution Joshua had given me was to put
htmlentities()
around the$value
variable in rc-custom-field-gui.class.php. It’s around line 33 for the text input field.Just thought you might be itnerested to know I’ve extended this a bit to add the header and instructions as suggested by me a while ago.. I can’t believe how easy it was! :) Thanks.
Interesting site. Useful information. Bookmarked.
Ok I’m really new at this so I’m sure this is a stupid question. I made my custom post form but I can’t get the results to display with the post. Anyway you can help me?
Jamie,
You have to add some code to your theme. Use the following plugin for easy way to do it: http://www.coffee2code.com/archives/2004/06/30/plugin-get-custom/
I’ve added a multiple select to my version – however I am having problems with it in WP2. It works fine in wp1.5, but if I have more than 5 custom fields in wp2, it overwrites the fifth one over and over until it is the same as the last one.. and some disappear.
actually the bug is different – it doesn’t let me have more than one field in the conf.ini with the same key..
what I wanted to do was a select with multiple options, but if an option wasn’t there a text box to set a customfield to that key also..
so my conf.ini is (excluding a few additions I’ve added to the code, but that won’t effect this problem).
[sizes]
type=select
values = NB-6m # 6-12m # 6-18m # 2-7yrs
[sizes]
type=”textfield”
it only shows the text field and not the select.. or the other way around if I list them in the opposite order.. any reason why?
Lellie,
You can’t have duplicate keys. I have to do major re-coding to support that. What you can do is to have key “sizes” and “custom size”. And when you display the meta, you check if there’s value for “custom size.” If there is than you display it; otherwise, display value from “sizes.”
Thanks joshua – yeah I’ve been looking at that and it doesn’t seem to like it.. I was looking at the code and decided it wasn’t worth the effort to change. I was thinking I’ll just have to change the key to “additional sizes” or similar..
Do you want my editted version btw – I’ve added a few new features.
1 new feature allows me to define in the conf.ini
[Header Text]
type=header
desc = Whatever I want to write under the header
[Another Smaller Header]
type=header2
desc = more explanatory text..
which produces a and respectively using the key text as header text and the description is put underneath as some explanation of the section. This is useful if you have a number of custom fields like I do – some which are for different types of story – so I’ve put a main header at the top of all the custom fields, and then smaller headers under each section (such as gigs, albums, books, films).
I’ve also added a “help” line to *all* the different form types which you can enter some text into and when you view the form you see a little help icon with some tooltip text.
Lastly I’ve added a multiple select item. Which you define some values to and you can now select multiple items from the list and it will take the array produced and save each one individually as custom fields..
bugger it stripped my html
“which produces a and respectively that should read.
still doesn’t like it.. that’s a h2 and h3.. :p
ooo gone further now..
I thought I might have more than one additional size and didn’t want to add 3 or 4 textfield options.
So I’ve now added a textarealist which allows you to type in multiple values on new lines – it then adds them as individual custom fields with the same key.
The only thing I can’t get is the GUI on the edit page for either the multiple select or this new textarealist to remember all of the entered values – it only selects the last one (or reenters the last one).. which isn’t the end of the world, but could be vastly improved.. I presume I need to edit the isset function, but any ideas how?
I got the plug to work and it is awesome. Your plugin made me think of a quick question that you might be able to answer. Is there a way to have static information appear on every post an author is going fill out? I want to make it so directions on how to fill out a post is on the post itself. Right now I’m cheating and just using your pluging and putting the directions next to a check box.
I’ve installed this on a 2.0.4 site and can’t seem to get it to work. Anyone else having trouble with this?
Re Jason’s comment 22.
I have tried to add the this Form functionality to PAGES as well as POSTS exactly as you described in your code example. I get the fields appearing in the admin backend, but the content won’t display on the live PAGES.
I added this line of code in ‘rc-custom-field-gui.php’ which now looks like this:
Any ideas anyone what I might be doing wrong ?
Many thanks
tim0fee
oops, I meant comment 21.
The code being:
add_action( ‘edit_page_form’, array( ‘rc_custom_field_gui’,’insert_gui’ ) );
Thanks,
tim0fee
PS I am running WP 2.0.4
and have added the following code to my file in: themes/default/index.php
If you can help me it would be very appreciated!
tim0fee
php the_meta();Â
(obviously within the php tags!)
Localization?
I’ve tried with accented vowels, both staight and HTML encoded in a select dropdown list and it breaks the input list. Any idea or approach?
BTW, thx for the plugin. I avoided Drupal complexity once again. ;-)
Have a good day,
hip
I found a ‘patch’ (say ammending) to the localization problem above.
In the rc_custom_field_gui.class.php there’re the functions echoing the form input fields (input(text), input(radio), textarea,…). Wrapping the (echoed) values in these functions with ‘htmlentities()’ does the trick.
I believe it doesn’t harm any of the english characters at all and let’s us (the ones developing in other languages than english) make use of a wider range of characters. I believe the plugin won’t have any issue because of these changes but I haven’t tested it yet.
Hope it helps.
Have a good day,
hip
I’m getting this error message – perhaps because I changed the conf.ini after having used it once. Anyway, deactivated, deleted the plugin and reinstaled but I get this error:
[You have an error in your SQL syntax near ‘t go if…” at line 1]
SELECT meta_value FROM wp_postmeta WHERE post_id = ’13’ AND meta_key = ‘Don’t go if…’
Maybe I need to clean the database?
Many thanks. Potentially a terrific plug. Are you not still developing it.
PS WordPress 2.04
Nigel, You cant have ‘ in your field names.
Joshua, is it possible to hook up a field with the wysiwyg-editor?
Johannes,
Can you elaborate on that?
In conf.ini is “type” equivalent to “key” in the original wp add a new custom field section?
Also…
I usually have 5 custom fields, 4 “enclosure” and 1 “thumbnail”. The 4 enclosure fields are each 5 lines long where the first 2 lines change daily, but the last 3 are always the same. I am trying to figure out how to make this work, but am kind of new to this and am not even sure I can do this with what you have done.
Any help would be greatly appreciated.