The Event custom fields block shows the values of your custom fields on the event page, such as a dress code or a list of speakers. You choose which fields appear and how they look.
The Event custom fields block is part of HappenBoard Pro. See what Pro adds.
Add the block
The block shows the fields of the event being displayed, so it belongs where an event is shown. The best place is your single event template: every event then shows its own fields.
- Open the template, or the event, in the editor.
- Click the block inserter and search for Event custom fields. It sits in the HappenBoard category with the other HappenBoard blocks.
- Place it where the fields should appear, for example under the description.
- Choose the fields and the display options in the sidebar, as explained below.
- Save.
The preview in the editor comes from the same code as the page, so what you see is what visitors get.
Choose the fields
The Fields panel lists every event field you have defined, with its full key under the label.
- Leave every box unticked to show all your event fields, in the order set under HappenBoard → Settings → Custom fields.
- Tick some boxes to show only those fields. They appear in the order you ticked them, so this block can use its own order.
Whatever you tick, the block leaves out a field that does not apply to this event: one limited to other categories, or hidden by its conditions. If a field you picked is deleted later, the editor warns you and the page skips it.
The block only shows values stored on the event. Visitors’ answers to your sign-up questions belong to each attendee, so the block neither lists nor shows those questions.
Choose how the fields look
| Setting | What it does | Default |
|---|---|---|
| Layout | Stacked (label above value), or Inline (label : value), which puts the label and the value on one line, the label followed by a colon. | Stacked |
| Show field labels | Shows each field’s label. Turn it off to show the values alone. | On |
| Hide fields with no value | Leaves out a field the event has left empty, so an event with no parking note shows no empty parking line. Checkbox fields always show, because “no” is an answer too. | On |
These settings are in the Display panel. The block also has the usual WordPress settings for colour, typography and spacing.
How each type appears
- URL: a link that opens in a new tab.
- Email: a link that opens a new message.
- Checkbox: a tick for yes, a dash for no.
- Number: in your site’s number format.
- Date: in the date format set in WordPress under Settings → General.
- Select (dropdown) and Radio buttons: the label of the chosen option.
- File (Media Library): a link to the file, named after the file’s title, opening in a new tab.
- Repeater (list of text rows): a bulleted list, one row per bullet.
- Text (multi-line): paragraphs, with your line breaks kept.
When the block shows nothing
If none of the chosen fields has a value, the block prints nothing on the page, not even an empty box. In the editor you see a short note instead, so you know the block is there.
A field with Show on the event page switched off never appears in this block, whatever you tick.
Classic themes: two PHP functions
If your theme uses PHP templates instead of blocks, HappenBoard Pro gives you two functions to call from a template file:
// The same list as the block: all fields, or the keys you name, in that order.
echo happenboard_pro_custom_fields_html( get_the_ID(), array( 'dress_code', 'parking' ) );
// One raw value, to lay out yourself. Use the key without the _happenboard_cf_ prefix.
$level = happenboard_pro_custom_field( get_the_ID(), 'level' );
The first function formats values as the block does. Pass null as the second argument for every field. A third argument takes show_labels and hide_empty, both true by default.
The second function returns the raw value. A date stays as YYYY-MM-DD, a dropdown answer gives the option’s value, a file its attachment ID and a repeater a list of rows. It ignores Show on the event page, so only print the fields you want visitors to see.
Next steps
- Creating custom fields: add fields, set their type and decide who fills them in.
- Building a single event page: the template where this block usually sits.
- Patterns and Site Editor templates: edit the event templates of a block theme.