Functions
Reference: functions
Every function UglyFields gives your theme, with its arguments and a link to the full guide.
In this chapter
Reading 6
- At a glance The shortcode is [ugly-fields]. It is at the end of this page.
- The $target argument ugly_get(), ugly_rows(), ugly_show(), ugly_update() and ugly_delete() all take the same last argument. It says where the value lives.
- ugly_get() Reads the value of a field. The value is not escaped: you are going to use it in code, so you escape it where you print it.
- ugly_show() Prints the value of a field, escaped for the place it goes in. A text is escaped as text; a URL as a URL; rich text is cleaned with the same list WordPress uses for posts.
- ugly_rows() The rows of a repeater or a flexible content [PRO], ready for a foreach.
- ugly_find() Finds posts by the value of their fields, with no meta_query to write.
Writing 2
Blocks and forms 3
- ugly_inner_blocks() Used inside the render file of a block that has "blocks inside". Prints what the editor put there. Nothing to escape: WordPress has already drawn it.
- ugly_form()Pro Prints a form on the site that fills the fields of one or more groups and saves them.
- ugly_form_html()Pro The same as ugly_form(), returned instead of printed. Use it when you build a string, for instance inside a shortcode.
Helpers 4
- ugly_html_attributes() Builds the attributes of a tag, each one escaped: name="value" other="value". A true prints the bare attribute (required), a false leaves it out.
- ugly_param_text() A request parameter as plain text, without the slashes WordPress adds. A list where a word was expected (name[]=x) gives an empty string, so a request made of lists never causes a warning.
- The shortcode Prints a field inside content, the way ugly_show() does in a theme. It works while Settings → Advanced → The [ugly-fields] shortcode is on (it is on by default).
- What does not exist If you come from ACF, you might look for these. They are not in UglyFields, on purpose.
No page matches. Try another word.
Where to go next
| You want to… | Read |
|---|---|
Understand why ugly_get() and ugly_show() differ |
The PHP API |
| Use them in a real job | Cookbook |
| Change behavior from code | Hooks and filters |
Did this article answer your question?
Thank you. It helps us make the documentation better. Need more help?