Print values
Print values
Show a text, an image, a link, a gallery or a repeater on your page.
In this chapter
- Print a text ugly_show() prints it safe for its type. To use the value in code instead:
- Print an image With the default What the code receives (The ID):
- Print a link as a button A Link field gives an array: url, title and target.
- Print a gallery Each item is what the field's return format says (an ID by default). For a grid with captions, see A gallery grid.
- Loop over a repeater ugly_rows() always gives a list, empty when there is nothing, so no if is needed around the loop. A row is a variable: pass it to get_template_part( 'parts/person', null, array( 'person' =>…
- Read a field of a group A Group field gives one row:
- Show the label of a choice, not its value For a Select, Radio buttons or Button group, choose what the code receives:
- Print a date in your own format A date comes back as text, in the format chosen in the field. To use another format, change the setting of the field, or reformat in code:
- Print only if there is something ugly_get() gives null when the field does not exist for that page, and an empty value when it exists and is empty. Both are false in an if. Inside a row, use $row->has( 'name' ).
No page matches. Try another word.
Did this article answer your question?
Thank you. It helps us make the documentation better. Need more help?