LiveWhale CMS

Welcome, Guest Login

Support Center

Our documentation is moving: docs.livewhale.com

Please check docs.livewhale.com for the most up-to-date LiveWhale CMS and LiveWhale Calendar documentation. The below legacy documentation will remain available as a reference until the documentation migration is complete.

Creating and Using Custom Fields

Last Updated: Oct 23, 2017 01:40PM PDT

You can create and manage custom fields to be added onto existing datatypes like news or events in order to add additional information for a specific need.

There are two methods that allow you to get and set custom fields. They are:

$_LW->getCustomFields($type, $id); // get a previously set custom field 
$_LW->setCustomFields($type, $id, $values, $hidden); // set a custom field

$type should match an existing LiveWhale datatype such as news, events, galleries, etc. This is used to associate the custom field data with the current item.

$id is the numeric id of the item to which the custom data should be associated.

$values is an associative array of the value(s) to set, in the form 'varname' => $value. (Please be sure to properly sanitize your incoming data before assigning them here, or use $_LW->_GET or $_LW->_POST in place of the server defaults.

$hidden is a simple array of string varnames that should not be available via the LiveWhale API or in front-end webpages or feeds.

To add the custom field you would do the following:

1. Go to ./livewhale/client/modules/

2. Create a directory called custom_fields

3. Create a new file titled, private.application.custom_fields.php

4. Insert the demo code below, which contains a variety of example handlers.  Change the example ID (dress_code in the example) to your field ID of choice, and the module you're working in if it's not events (as in the example).

5. Go to your LiveWhale login screen to activate the change. If you are already logged in, log out and re-login.

6. To add the value of the custom field into your content type's detail pages you would prepend 'custom_' to the name of the field you created in your code. 

eb8f96c071020d8b0923da726d6cab65@livewhale.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete?b_id=4256