Simple Fields is WordPress Custom Fields on Steroids

I’ve created a new plugin for WordPress that now is ready for beta-testing. It’s called Simple Fields (and it requires WP 3), and it’s gonna rule your world (at least it rules my world – your opinion may vary).

The purpose of Simple Fields is to make it easy to display different kind of fields (text, textarea, checkboxes, radiobuttons, files…) when you edit a post. Fields that an administrator of a web site can change and edit. And fields that you can use in your page templates to perform different tasks.

I think some examples is the best way to show you how cool and useful this plugin is:

Example 1: create options for a page

Say you have a client website where they want to show a ”share this”-button on some pages, but on some other pages they don’t. And of course the client wants to be able to change this on a per-page-basis.

With Simple Fields it’s easy: add a field group with a checkbox called ”Show share-button”. It will then look like this when your client edit a post:

Cool eh? Now say the client also wants to be able to choose the style of the the share-button – size, color, whatever. No problem: edit your Simple Fields and add a dropdown with all the options you want to be available.

The next time the client edits the post it will look like this:

Now that’s a lovely drop down, dontcha think?

Example 2: repeatable fields = super easy slideshows!

Now for something a bit more advanced nah still a piece of cake: repeatable field groups. This is one of the features I really really really like with this plugin.

It’s very common these days for a web page to have multiple images, often displayed as a slideshow, where each image have it’s own caption and destination link. In WP you usually set up your images through the use of the built in custom fields. However, you (I do anyway…) can run into problems when you want to change to order of the images or add alternative texts (for the visually impaired and for search engines).

Using Simple Fields for this is so much easier and smarter: set up a new field group and add all the required fields. So something like this will get us started (ok, I went a bit crazy here and also added options for delay and transition effect, just to show off a bit!):

Wow, amazing! We can now add… one image to the post! But we want to be able to add any number of images to the post. Now this is where repeatable field groups come into action. We just change the Slideshow field group to be a ”repeatable field group”, and then edit the page again:

Wohaa! See the small, but yet huge, difference? Yes, we now have a ”Add”-link at the top. Click on that and you will get a new set of fields, like this:

See, now we have all required fields for two images. Want to have four images? Just click the add-link two more times and you’re done. Want to change the order of the images? No problem, just drag and drop!

That’s it for now

Ok, that’s it for now. I hope this short intro gave you some understanding of how this plugin works and what it is useful for. I would love if you took it for a beta-drive. And I would love if you gave me some feedback.

Download Simple Fields

You can download the plugin from wordpress.org.


Publicerat

i

av

Kommentarer

48 svar till ”Simple Fields is WordPress Custom Fields on Steroids”

  1. Profilbild för erwan

    Hi, your plugin is very interesting.

    It has a fetaure I need : repeatable fields

    but are you planning to implmeent template specific custom fields, like Custom Field template does ?

    1. Profilbild för Pär
      Pär

      Thanks for the feedback!

      I haven’t thought any of template specific fields yet. For now I’m more into page-specific fields. Maybe because I don’t work that much with templates right now (not templates you can choose, anyway).

      I will however add template specific custom fields to my list of ”things to consider”.

      1. Profilbild för Alexander Hultner
        Alexander Hultner

        Actually template specific custom fields would be awesome. I really do like the idea.

  2. Profilbild för Vayu

    Hej Pär.

    I like your plugin. Well done!

    I think it would be nice to have the option of having these ekstra custom fields be visible as a default, so the user doesnt have to chose from the Simple Field dropdown and save first.

    Vayu

    1. Profilbild för Pär
      Pär

      Thanks!

      Check out ”Post type defaults” in Simple Fields admin. There you can choose what connector to use as default for a post. Unless there is a bug somewhere, it should do the work for you.

      1. Profilbild för Vayu

        Ah, okay thanks! I get an error here.

        Call to undefined function get_post_type_object().

        Maybe this is WP 3.0 function?

        1. Profilbild för Pär
          Pär

          Yes, get_post_type_object is available since WP 3. Since WordPress 3 will be released very soon I’ve decided that Simple Fields will require it. Sorry if this causes any problems for you.

          1. Profilbild för Vayu

            Hi again Pär.

            I think your plugin is brilliant! 🙂

            One feature that I am missing though, is to have multiple default post connectors for a post type.

            Just a wish from a fellow Scandinavian.

            Cordially
            Vayu

  3. Profilbild för Björn Ali
    Björn Ali

    Hi,

    A field type that would be awesome, for which I had to make my own plugin, would be ”link to post”.

    Mine is extremely simple, with no options backend (just a table with rows).

    It creates a drop-down with the post titles of the selected post type, the ID of which is added as the meta.

    Then a ”get_linked_post(’my_tag_name’)” can be used within the loop.

    Of course, if this plugin gets a bit more cunning, I will retire my own plugin at once. 🙂

    1. Profilbild för Pär
      Pär

      Good idea. I’ll see if that’s something that I can implement.

  4. Profilbild för Ross
    Ross

    Hi,

    This plugin is great and does exactly what I’ve been searching for. I’ve installed in (in WP3) and its working fine, however if I choose type=”file” – when I click on the ”select file” link in post admin, I just get a blank popup window.

    Am I missing something?

    1. Profilbild för Pär
      Pär

      It should work. What version of PHP and browser+version are you using?

      1. Profilbild för Ross
        Ross

        I’m using PHP Version 5.3.2, and have tried it in Firefox 3.6.6 and Safari 5.0 on a Mac.

        The wordpress install is using MAMP running locally on my machine with the base url of http://localhost:8888 – could that be causing an issue?

        1. Profilbild för Ross
          Ross

          It must be something with the MAMP/locally hosted setup. I’ve just installed Simple Fields on a live blog installation and the file picker popup is working perfectly!

          This really is a useful plugin – good work!

          1. Profilbild för Ross
            Ross

            A further update – I’ve since discovered that the problem was a conflict with the Custom Post Templates plugin – when I deactivated that plugin the popup media browser worked fine.

          2. Profilbild för Pär
            Pär

            Ok, good job debuging Ross 🙂

            I’ll install Custom Post Templates and see if I also get the problem.

          3. Profilbild för Pär
            Pär

            Ok! I got that error too after activating Custom Post Templates. And.. *drumroll* I also managed to fix the problem. So update Simple Fields to the latest version and everything should work just fine.

            Let me know if it the new version works for you!

          4. Profilbild för Ross
            Ross

            Great! Updated the plugin and its working perfectly – thanks for the impressively quick fix!

  5. Profilbild för marc
    marc

    Found a bug.

    If this plugin is installed, it disables the ability to ’Show’ media in the Media/Image Uploader of a post.

    If I click on it, I see that the post admin in the lightboxed background seems to move very slightly downwards on each click. Really weird.

    If I deactivate the plugin I’m able to ’Show’ the image details in the image uploader Gallery tab once again.

    AMAZING plugin otherwise!

    Email me if you need any help from me locating the bug.

    Marc

    1. Profilbild för Vassilis Mastorostergios

      Hey, let me just congratulate you on an amazing plugin, really helped alot but, is there any info on the bug that breaks the media gallery show button, as marc describes? Happens to me also.

      Also one more thing: If anyone is looking on how to get the URL of a file he uploads using the plugin this is the way:

      $field_id = get_post_meta( $post->ID, ’_simple_fields_fieldGroupID_2_fieldID_1_numInSet_0’, true ); echo wp_get_attachment_url($field_id);

      (wrap in etc..) this will return the file URL

      Thanks in advance

  6. Profilbild för HS
    HS

    I’ve tried a few different setups, but none of the Simple Fields show up. Is there anything I should add to my theme?

    1. Profilbild för Pär
      Pär

      The fields your adding to your posts/pages does not show up automatically in your theme. You must manually add it, using wordpress own functions, using a plugin, or using the functions that I created for simple fields.

      These links may get you started:

      http://wordpress.org/extend/plugins/custom-fields-shortcode/

      http://wordpress.org/extend/plugins/conditional-custom-fields-shortcode/

      http://codex.wordpress.org/Function_Reference/get_post_meta

      http://eskapism.se/code-playground/simple-fields/functions/

      http://eskapism.se/code-playground/simple-fields/tutorial/

  7. Profilbild för Acebone
    Acebone

    Hey!

    Looks way cool. Is there an option to have simple-fields on a pr. post-type basis, or are all simple-fields shown on all post-types?

  8. Profilbild för Acebone
    Acebone

    Sorry, that was a lazy q – By browsing your site I realised that it does!

    😉

    1. Profilbild för Pär
      Pär

      🙂

  9. Profilbild för Acebone
    Acebone

    Hi!

    A couple of questions:

    1. I have tried to find info on how to make a custom post type available to all subsites in a WP Network setup. Would you happen to have a link or the likes for that info?

    2. When I do manage to find out how to do that, do you think that simple-fields will play along, so that I won’t have to define field-groups and connectors for each subsite?

    3. Not a question, just a support for the petition for a unix-datestamp-field – I really need it! 😀

    Cheers!

    Esben

  10. Profilbild för Acebone
    Acebone

    Back again w. just a quick idea:

    It would be nice to have a field type called ’Help’ or similar, making it possible for the dev to add some helpful commentary that would be displayed to the user.

    So not a user-editable field, but a block of HTML inserted into the field-group (at the position the dev specifies)

    Above a file upload you could have:

    ”Only jpg or png images. Make sure that the file you upload ends with either .jpg or .png”

    Of course it should be HTML, so that the dev gets max. freedom in regards to the content he wants to display to the user, however it wouldn’t have to be a rich-edit box, simple textarea would do.

    Just an idea, hope you can use it!

  11. Profilbild för Andreas Jacob

    Hi Pär,

    is there a (simple) way to use the data from simple fields in another plugins output?

    I try to reuse some data within the output of the wp-print plugin.

    Many thanks

  12. Profilbild för Markus

    great plugin but i have still problems with ”Custom Field Template” Plugin. Only if I disable the plugin it works…
    i don´t get a image thumbnail…

    I use WP 3.02 with the latest version of Simple Fields!

    1. Profilbild för Pär
      Pär

      It’s on my todo-list to check that issue. I haven’t had the time to look into it yet.

  13. Profilbild för Marco
    Marco

    looks promising, just testing it. the feature i’m missing
    the most is the possibility to connect field groups with
    categories. we have custom post types now, but (imho) at the moment
    they are far from being as user friendly, flexble and fast to use
    as the categories taxonomy – at least for my purposes. i could do
    that with ’magic fields’, but that inserts an entry in the sidebar
    for each type of custom interface one adds – and i need too much of
    them. is it hard to add categories to the list of supported post
    types? thumbs up!

  14. Profilbild för David
    David

    Any chance of having default values for text fields? I am using text area fields and it would be nice to be able to set a default value for some of them.

    1. Profilbild för Pär
      Pär

      Yep, that would be nice. It’s on the todo!

  15. Profilbild för Jan Fjordside

    Hey Pär, thankyou so much for this great plugin – think its going to be my prefered wp plug.

    One thing that would make it even better (for me anywaws 🙂 ) would be for it to work alongside the moretypes plugin – i would like to be able to easily define new posttypes and chain these with the writepanels i have defined in your great plugin.

    It kinda works allready, but the filebrowser dialog breaks. When i want to select a file from the media library the libray opens in a fullscreen mode, and wont let me return to the page i was creating.

    If this is something you would consider putting on your todo list, please let me know if you need anything from me.

    Again thanks for this great plugin 🙂

  16. Profilbild för Lindsay

    This is a pretty nice plugin to help with gathering the data in the post editor, but how do I find out what the custom field names that it is creating to store the data are? Even better, can I specify what meta keys I want it to use?

    I already have a site that relies heavily on custom fields which have keys defined/referenced in templates and plugins, but was looking for an easier way to enter the data on posts. I really would prefer not to update all my code with different meta keys than I am already using, so being able to specify which ones to use in this plugin would be great. At the very least, knowing how to find what keys are actually being created would be helpful.

    Could you offer any insight there, please?

    Thanks for the great plugin. It has a good bit of potential!

  17. Profilbild för James
    James

    same here, how do you find out what the field name is so that you can use a function like get_field(’fieldname’)

  18. Profilbild för Hansaplastique

    Excellent plugin – exactly what I was looking for 🙂

    Would be nice to be able to define/enter your own meta-key ”name” since identifying ”_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0” isn’t very obvious.

    Anyway, I’m not complaining. This plugin is great. Excellent work guys! 🙂

  19. Profilbild för William
    William

    Finally I have found the most complete plugin for a project Im working on.

  20. Profilbild för Joachim
    Joachim

    The plugin is no longer working correct in WP 3.2, when you drag&drop a image-upload field, you get an ”tinyMCE is not defined” error (rule 47 in scripts.js)

    1. Profilbild för Pär
      Pär

      Thanks for the bug report. I’ll take a look at this.

  21. Profilbild för Bobz

    Any news about tinymce error?
    I get same error ’not defined’ in textarea field when using ’wysiwyg editor’.
    not defined – line 80 – scripts.js file

    1. Profilbild för Erik
      Erik

      Been having the same problem. After upgrading WP to 3.2.1 the TinyMCE stopped working.

      After a couple of hours looking around and trying different things, I found the solution:

      you need to add wp_tiny_mce( false ); to the function simple_fields_admin_head:

      function simple_fields_admin_head() {

      wp_tiny_mce( false ); //this is new

      // Add meta box to post
      global $post;
      ….

      Here’s an article I found usefull:
      http://dannyvankooten.com/450/tinymce-wysiwyg-editor-in-wordpress-plugin/

      Hope it helps.

  22. Profilbild för John

    ID, $key, true);
    echo $imagenum1

    This code returns the value 29 with an image added to the indicated field. I was hoping for a file path and/or name. Do I misunderstand something?

  23. Profilbild för John

    deletes all my content whin I switch between connectors!

  24. Profilbild för Russ

    I’ve uploaded a stack of snippets for Simplefields, from image sliders to basic text and image combos.

    http://snipt.net/heyfennec

  25. Profilbild för young
    young

    Either i’m not seeing the obvious or there is something clearly wrong with me. for the last 2 days i have been trying to show the fields in my front end and to my unbelief its just not showing
    i have tried to put it on the page on the page.php file from the theme but nothing is working.

    please assist.

  26. Profilbild för John
    John

    I’ve seen this complaint frequently:
    ”deletes all my content whin I switch between connectors!”
    I have the same issue.
    any thoughts?
    thanks,
    John