Osclass theme custom field show more times

If you have any osclass theme and want to display one or more times any custom field or more fields, then you need to follow this steps.

First step is to indentify the name for your custom field. Go to your control panel > Listings > Custom Fields:

Another way to indetify the name for any custom field: Go to your  PhpMyAdmin, then choose oc_t_meta_fields:

Now, when you know the field name, you need to add the code in your file: item.php.

This line need to be added where your custom fields should be displayed:
“<?php View::newInstance()->_erase(‘metafields’); ?>”

For example we have by default the code which show all custom fields:

<?php if( osc_count_item_meta() >= 1 ) { ?>
<div class=”meta_list”>
<?php View::newInstance()->_erase(‘metafields’); ?><?php while ( osc_has_item_meta() ) { ?>
<?php if(osc_item_meta_value()!=”) { ?>
<div class=”meta”>
<strong><?php echo osc_item_meta_name(); ?>:</strong> <?php echo osc_item_meta_value(); ?>
</div>
<?php } ?>
<?php } ?>
<?php } ?>

If you want to show only one field you need to add this code:

<?php View::newInstance()->_erase(‘metafields’);
$custom_field_content = array();
if( osc_count_item_meta() >= 1 ) {
while ( osc_has_item_meta() ) {
if(osc_item_meta_value() !=””) {
$custom_field_name_content[osc_item_meta_slug()] = osc_item_meta_name();
$custom_field_value_content[osc_item_meta_slug()] = osc_item_meta_value();
}
}
} ?>

<?php echo $custom_field_name_content[‘change_with_your_custom_field_name’] ;?>: <strong><?php echo $custom_field_value_content[‘change_with_your_custom_field_name’] ;?>