Osclass forums
Support forums => old => Topic started by: tinkerton on June 14, 2015, 11:26:51 pm
-
I want content from custom fields to be displayed under the pictures in Grid Listing Format. I've read that custom fields need to be separated but I can't seem to make it work. I found out that I could change the content below the picture in my main page by editing this code in /themes/osclasswizards/loop-grid.php.
(http://i61.tinypic.com/25qahrr.png)
<article> <span class="category"><i class="fa fa-map-marker"></i> <?php echo osc_item_category() ; ?></span> <span class="location"> <i class="fa fa-map-marker"></i> <?php echo osc_item_city(); ?>
<?php if( osc_item_region()!='' ) { ?>
(<?php echo osc_item_region(); ?>)
<?php } ?>
</span> <span class="date"> <i class="fa fa-clock-o"></i> <?php echo osc_format_date(osc_item_pub_date()); ?> </span> </article>
Also, I'm having trouble changing the content displayed in the Category Pages. Which file is responsible for the grid listing in category pages?
Theme: OsclassWizards 2.0.0 by OsclassWizards
Osclass 3.5.7
-
Hi,
after a quick search I found this thread, see if it can help you:
http://forums.osclass.org/bender/explode-custom-fields-on-item-php/ (http://forums.osclass.org/bender/explode-custom-fields-on-item-php/)
Regards,
Eric
-
Hi,
I think this most recent solution is better:
http://forums.osclass.org/themes/problem-on-the-call-two-time-meta-field/msg106769/#msg106769 (http://forums.osclass.org/themes/problem-on-the-call-two-time-meta-field/msg106769/#msg106769)
Regards
-
For any kind of theme related bugs you can report here
http://forums.osclass.org/themes/osclasswizards-free-responsive-bootstrap-theme/ (http://forums.osclass.org/themes/osclasswizards-free-responsive-bootstrap-theme/)
-
Thanks! I finally got it to work. :)
-
Great tinkerton,
please help others with your fix / solution by telling us what you exactly did and what the result is.
Also we'd like to ask you to put SOLVED inthe subject of this thread so others can see this question also has a solution.
Thanks,
Eric
-
Step 1:
Add this at the very bottom of your theme functions.php (take care not to leave blank lines after this):
<?php
function cust_get_custom_field_value($name) {
$getItemMeta = osc_get_item_meta();
$name = '/^'. $name . '$/';
$index = array_filter($getItemMeta, function($a) use($name) {
return preg_grep($name, $a);
});
return $getItemMeta[key($index)]['s_value'];
}
?>
Step 2:
Now in loop-grid.php and loop-search-grid.php put this where you want your custom field. Custom field name = customfield1
<?php echo cust_get_custom_field_value(customfield1); ?>
Thanks!
-
Something I will be using
Thanks
-
Hi guys! First appreciate for sharing your solutions! Great work! Wondering if it's possible to use this with custom attr plugins like cars attributes. Need some custom fields from cars attributes put in loop-search-grid.php. Tried this but not working for me on osclasswizards theme
-
yes you can do that if you have a little php knowledge.
-
Any ideas how to use this with Multilanguage Custom Fields?
It works and the field names gets translated, but the values don't.
-
Hi,
The plugin includes a special function to do just that: mlcf_get_translated_custom_field('identifier'), see Help page.
Regards
-
Hi,
The plugin includes a special function to do just that: mlcf_get_translated_custom_field('identifier'), see Help page.
Regards
Oh, didn't notice that before, thanks. ;)