Tutorials!

One of the most bigger issues in Magic Fields was the lack of documentation, learn how use Magic Fields was a hard task but this going to change soon.

Hunk the last week  spent his time writing a good  number of tutorials you can found them here:  http://wiki.magicfields.org/doku.php?id=es:tutorials

If you are user of Magic Fields i’m sure to you realize to our english is not perfect for that reason our first concern for write the documentation was not be able to be the enough clear for explain how magic fields works

For that we  take the decision of write the documentation in our mother language and  wait for somebody to help us to move this  documentation to another  language, if you want to help us to move the documentation to another lang feel free to  register as user in the wiki of magic fields and start to translate.


Script for migrating from Flutter V 1.1 and 1.0,1.2 and 1.3, and 1.4.5

Hi Folks.

Edgar wrote a script for  migrating from the last version of flutter (v1.0 or v 1.1)  to magic fields (v 1.1).

You can download the script from here:

http://gist.github.com/198537

or from here:

http://magicfields.org/wp-content/uploads/2009/09/migra.txt

How use it.

Just follow the next steps:

Download the script here you have a raw version.

Make a backup of your database (for any unexpected bug).

Unactive flutter

Put the script in your parent folder (where you has the wp-config.php and all these stuff)

Rename the script from migra.txt to migra.php

Enter to  http://yoursite.tld/migra.php

And its all,  this script change all reference from flutter to magic fields.

Change the name of your  folder  files_flutter to files_mf

Put the Magic fields plugin in your plugins folder.

In your admin area active Magic Fields.

And its done.

UPDATE:

for the version 1.2 of Magic Fields uses this script. http://gist.github.com/227581

UPDATE:

for the version 1.3 of Magic Fields uses this script. http://gist.github.com/284805

UPDATE:

for the version 1.4.5 of Magic Fields uses this script. http://gist.github.com/558207



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.


Getting Started

This tutorial will be explain the basic use of Magic Fields, how create write panels, how create custom fields and how print in the template.

Installing Magic Fields.

Magic Fields is installed as any wordpress plugin, you just need download from his download page, put the folder in:

wp-content/plugins

And in the admin area in the plugins section do click in the “activate” link and its all.

When you active the plugin the first thing to Magic Field ask is for create two folders, this folders are:

/wp-content/files-mf /

and

/wp-content/plugins/Magic-Fields/thirdparty/phpthumb/cache

Is enough to you create these folders and give them enough permissions for be writable by Magic Fields

Now we are on road for start to use Magic Fields!

Basic Usage

The best way to understand how Magic Fields Works is with a example, in this example i want create a portfolio of my work. So, the first thing to do is a create a category called “portfolio” and after that create our write panel and assigned the category “portfolio”

Add a new write panel

Add a new write panel

Write Panels ‹ magic_fields — WordPress

In the write panel page exists many options, this options will be explained more a detail in the future for now i just leave the options by default.

Write Panels ‹ magic_fields — WordPress-1

After to create the write panel I’m going to add custom fields for this write panel, for now I will create just one custom field for add the services to I gave to the client.

create_field

Write Panels ‹ magic_fields — WordPress-2

In this page I can choice what type of custom field I want in this case I want a textbox field, and I give the name of “services” and the Label of Services.

I don’t want to this field be required and I don’t want to this field can be duplicated. (the duplicate featured will be explain in detail in the next’s posts)

And it’s all now we can enter to the portfolio panel and now we can start to create content.

Add New Post ‹ magic_fields — WordPress-1

We can view our post created with our write panel in the “Manage” option.

Edit Posts ‹ magic_fields — WordPress

Displaying our information in the template.

Well now we need display the information to be added in our template, for that Magic Fields give us a little api for this. Lets go.

In our single.php file we can add this:

echo get('services');

And it’s all.

Now if we visit the post we will see the information to we put in the services field.

Client name « magic_fields

Exists many more things to we can do with Magic Fields, in the next’s posts I will talk about the differents types of fields.

UPDATE: For more information about Magic fields visit the wiki