Types of Custom Fields.

In Magic Fields, there are 12 types of “fields”. Below is a detailed explanation of each “field” and how to use them in WordPress.

Please note that the code used to display each “MagicField” must be inside one of the WordPress loops. E.g. In the default theme, “the_content();” is displayed within the “single.php” file – please see the image below:

single

Textbox.

Textbox


Usage:

echo get(‘field_name’);

Return:  String.

Multiline.

For this field, the same filters used for “the_content();” may be applied using “shortcode“. Please see the images below:

multiline

shortcode

Usage:

echo get(‘field_name’);

Return: String.

Checkbox.

checkbox

Usage:

$value = get('field_name');

if($value){  /*Something*/ }

Return: Bool.

Checkbox List

check_box_list

Usage :

$my_list = get(‘field_name’);

foreach($my_list as $element){

echo   $element;

}

Return: Array

DropDown List

check_box_list

Usage:

$my_option = get(‘checkbox’);

echo  $my_option;

Return: String

ListBox

Add New Post ‹ Magic Fields — WordPress

Usage:

$my_list = get(‘field_name’);

foreach($my_list as $element){

echo   $element;

}

Return: Array

Images

image-1

Usage:

$my_image_url = get(‘field_name’);

/**

* With this method is returned the absolute url

* of the image

**/


get_image(‘field_name’);

/**is returned the image tag of html**/

Return: String

Date

date2

date

Usage:

$my_date = get(‘field_name’);

Return: String. (Return the date in the same format  to was selected when was created the custom field, actually exists 8 differents formats of dates)

Audio

Audio

Usage:

$mp3_url = get(‘field_name’);

/**

* With this method return

* the absolute url of the image

**/


echo get_audio(‘field_name’);

/**

*With this method return a flash player

* for the user can ear the song

**/

Color Picker

color_picker1

colorpicker2

Usage:

$color = get(‘field_name’);

Return : String  (hexadecimal number of the Color )

Slider

slider

Usage:

$value = get(‘field_name’);

Return: String.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • BarraPunto
  • LinkedIn
  • Meneame
  • Reddit
  • Slashdot
  • Tumblr

97 Responses to “Types of Custom Fields.”

  1. Pete says:

    would the [gallery] short code work?

  2. jan says:

    Hey guys, I have the same trouble in flutter and magicfields: all breaks in the multinine textfield disappear if I switch between html and visual. with some users they also disappear without switching. any idea? greets!

  3. dobleclic says:

    Hi,
    Great plugin!
    I want to add a title for a custom field, and I need to hide this title if the custom file is empty.
    How can I do that?
    Thanks!

  4. hunk says:

    hi jan we will review multiline.

    hi doblelick. this that you want to do is template? if it is thus, you can use something like
    < ?php
    if(get('name_field')){
    //code
    }else{
    // more code
    }
    ?>

  5. isni says:

    hi hunk.. great plugins.. tq for your time..
    but i have a problem..
    i make an image custom field, but i cant delete it (using delete text under the thumbnail ini editing page). is it a bugs? or only mine? tq for your answer

  6. Gnuget says:

    Hi isni,

    What problem you have when you are deleting the image? when you do click in the image this is not deleted or when you deleted the imagen after to refresh the page the image appear again?

  7. Diaan says:

    Hi

    There is still no guide for how to deal with file uploads, neither does there seem to be a function for getting files.

    I have also tried to simply use get(‘field_name’) but that returns nothing.

  8. terryteo says:

    first of all, great news that flutter is rising from the ashes. ill be following this development eagerly.

    with regards to nr above, returing duplicate groups or duplicate fields has always been flawed in flutter, because when you delete a duplicate then add another duplicate it throws the whole order out.

    there is a good fix by thang and nick keenan on this page.
    http://groups.google.com/group/flutter-support/browse_thread/thread/904038d01c85ac8c/fa0acab9c99504ae?lnk=gst&q=i%2B%2B#fa0acab9c99504ae

  9. [...] is the original post: Types of Custom Fields. | Magic Fields Comments0 Leave a Reply Click here to cancel [...]

  10. Roy says:

    How come the anchor buttons don’t work in the multiline editor?

  11. Roy says:

    Nevermind guys, I messed up.
    Keep up the good work!!

  12. Lenner says:

    Hi Guys, great plug, image upload actually works unlike flutter. Still can’t get api for file upload to work. Hunk’s wiki link says it’s just get(‘pdfupload’) but I get this “http://localhost/www/burnt%20pine%20weddings/wp/wp-content/files_mf/file.pdf”, the actualy path, I need a link to the file.

    I also tried get_file(‘pdfupload’) but no luck, can someone please clear this up, as this is vital info. thanks

  13. jason says:

    Good to see some further development of flutter.

    Feature requests:
    image associated with checkbox
    google maps field
    youtube field
    xml export or integration with feed wrangler

  14. Jeff Arnold says:

    Hi,
    Sorry if this is a dumb question. I need a list option, either list box, check box, drop down. Its not important. Which only permits 1 selection. Is that possible ?
    i.e. if pretend its a list of measurements. if they select gram. Then Kg or litre cannot also be selected.
    Many Thanks

  15. Jeff Arnold says:

    Hi
    Again sorry for another dumb question. Is it possible to remove the default Upload / Insert Box WordPress gives. All of the fields are specified as your fields. I do not want the default. Is this possible.
    Many Thanks for any help.

  16. emma says:

    Hiya
    Thanks for this great great plugin! It’s very helpful. I’m wondering though, how do I add an alt tag to my images?
    Thanks

  17. tom says:

    @emma use alt=”

    Thanks for this plug-in, just spent all day struggling with flutter then found this!!

    Should note on this guide not to copy and paste as get_image(‘field_name’); should be get_image(‘field_name’);

  18. devdarsh says:

    Currently i am using is amazing plugin. Why draft posts are not showing in manage section of respective custom write panel?
    While i do a draft using any write panel, it doesn’t show in respective custom write panel manage tab. I can only see that in default edit posts page.

Leave a Reply

Stop SOPA