- Create a copy of a Magic Fields 2 custom post copying all the Magic Fields’ custom fields, custom groups and custom taxonomies. [ See details. ]
- Supports a shortcode for showing Magic Fields custom fields and custom taxonomies. In particular, the shortcodes makes it easy to display a table of custom field names and their values. [ See details. ]
- Identify and delete unreferenced media files in the folder files_mf. [ See details. ]
- Provides an alternate related type field which uses multiple selection checkboxes instead of a single selection dropdown. [ See details. ]
- Provides a search widget that does searches based on Magic Fields’ field values. [ See details. ]
- Provides an alternate textbox field that allows you to select previously entered data. [ See details. ]
Since Magic Fields 2 uses its own non-standard implementation for custom fields, generic utilities probably will not work and plugins such as this are necessary. This plugin can be downloaded from the wordpress.org plugin directory from May 1, 2013.
Copy a Custom Post
Show Custom Field with Shortcodes
[show_custom_field field="a ; separated sequence of field name patterns" filter="name of a filter function to apply to the values" before="prefix string before each value" after="suffix string after each value" separator="separator string between multi-valued values e.g. ", "" field_before="prefix string before each field" field_after="suffix string after each field" field_separator="separator string between fields e.g. "; "" final="name of a filter function to apply to the final result" post_id="an optional post id" ]
into the post content. A field may be a field name e.g. “alpha”, an indexed field name e.g. “alpha<1,2>”, a name of a grouped field e.g. “beta_gamma”, an indexed name of a grouped field e.g. “beta_gamma<1,2>”. The group index is first followed by the field index. If indices are not specified they default to “<1,1>”. The wild card asterisk “*” can be used for an index e.g. “alpha<1,*>” or “beta_gamma<*,*>”. The wild card asterisk “*” can also be used for the field name of a group e.g. “beta_*<1,*>”. In particular, “__default_*<1,*>” will iterate over all non-grouped fields in a post since non-grouped fields internally belongs to the group “__default”. Recursion is supported on related types. If alpha is of related type then “alpha<1,1>.beta<1,1>” will show the first value of the beta field in the related post specified by first alpha value. A field can be a semicolon “;” separated sequence e.g. “alpha<*,*>;beta<*,*>”. You may also use a taxonomy name as a field – in which case the terms of the taxonomy are shown.
The field_before and field_after parameter strings can contain the HTML comment strings “<!‑‑$Field‑‑>” and “<!‑‑$field‑‑>”. These strings will be replaced by the field label and field slug, respectively. To understand the difference between before, after and separator and field_before, field_after and field_separator let us suppose we have two fields alpha and beta, alpha is a multi-valued with values – “a”, “bb”, “ccc”, beta is a single-valued field with value “dddd”. Then “[show_custom_field field="alpha;beta" separator=", " field_before="<!‑‑$Field‑‑>: " field_separator="; "]” displays “alpha: a, bb, ccc; beta: dddd”. To display as rows in a table use “[show_custom_field field="alpha;beta" separator=", " field_before="<tr><td><!‑‑$Field‑‑></td><td>" field_after="</td></tr>"]“.
The value filter function has three arguments: $value, $field and $type where $field is the name of the field and $type is the type of the field, e.g. textbox, related_type, image, image_media, checkbox_list, … The filter parameter may be a semicolon “;” separated sequence of function names. The functions will be applied in the order given. The toolkit provides the pre-defined filter url_to_link($value, $field, $type) which for types related_type, alt_related_type, image and image_media the value is changed to a HTML <a> element. Unless you have your own filter you should always specify this filter as the raw value of these types are not user friendly. The final filter function has two arguments: $value and $field where $value is the final output of show_custom_field and $field is the field parameter. This also may be a semicolon “;” separated sequence.
Clean folder “files_mf”
Alternate Related Type
Search by Magic Fields’ Field Values
The number in parenthesis is the number of posts with that value. The select boxes list the 16 most frequent values in descending order. The select boxes are multiple select. A multiple selection is an OR of the selections. If more than one select box/text box is used the post must satisfy all the criteria of the used boxes. Except for related type and image media fields you can also manually enter the search text. You can also search on post content.
How to report problems, ask questions, …
Please post your problem reports, questions, requests and comments to the Magic Fields 2 Toolkit support forum.