2 Feb 26, 2014 17:03
The custom field code normally needs to be inserted in _item_content_inc.php which is in your skin folder. I wanted to put mine after the main article so I put it just before the line that says "// URL link, if the post has one:". Some skins might not have this line. If you want the code elsewhere in the page just move it.
The default code $Item->custom_fields() with no parameters shows the title of each field bold, a <br /> at the end of each field, and the body of the field as unstyled body text. So each field appears on a new line, with a bold title. If you are happy with this format then leave it as it is. If you want to format the custom fields you will need to put some extra code in.
This is my sample amended code which displays the custom fields with the default style values - but unlike the simple code with no parameters this allows you to edit those values.
Note that if you do not have a 'field format' parameter the fields will display as an unstyled string, so you will almost always need this if you are not going with the default style.
$Item->custom_fields( array( 'before' => '', 'after' => '', 'field_format' => '<strong>$title$</strong> $value$<br />', ) );
To style this block you will need to add your html tags in the three parameter strings. Here is another example, this time with styles:
$Item->custom_fields( array( 'before' => '<div class="customfieldbox">', 'after' => '</div>', 'field_format' => '<p class="customfieldboxitem"><strong>$title$</strong> $value$</p>', ) );