/** * DEVELOPERS: * This file is the default view, and is designed to utilize the "Display" settings from the dashboard. * * This file is loaded when the display setting "Display Listing as Table" is set to "Yes". * * You can absolutely override this utilizing WP Inventory's Override functionality. * Look at the file "loop-all-sample.php" for an example of how to modify these files. * * The loop specifically designed for the shortcode. * This file may be overridden by copying it into your theme directory, into a folder titled wpinventory/views/loop-shortcode.php * While inventory does not use the WP post types, it does model functions after the WP core functions * to provide similar functionality * */ if (wpinventory_is_single()) { wpinventory_get_template_part('single-item'); return; } wpinventory_get_items(); echo wpinventory_filter_form('filter=true&sort=true'); global $inventory_display; $inventory_display = wpinventory_get_display_settings('listing'); if (wpinventory_have_items()) { ?> <table class="wpinventory_loop wpinventory_loop_category wpinventory_loop_category-<?php echo wpinventory_get_the_category_ID(); ?> "> <thead>
/** * To be utilized similar to WP the_content, the_title, etc - however, there's enough fields * that we want to not be tied down to individual functions. Further, if the user passes in * a custom field label, we still want to be able to get it. * * @param string $field */ function wpinventory_get_field($field) { $context = wpinventory_is_single() ? 'detail' : 'listing'; $size = wpinventory_get_config('display_' . $context . '_image_size'); if ($field == 'inventory_image') { return wpinventory_image_tags(wpinventory_get_the_featured_image($size)); } if ($field == 'inventory_images') { $images = wpinventory_get_the_images($size); $imgs = ''; foreach ((array) $images as $image) { $imgs .= wpinventory_get_image_tags($image); } return $imgs; } if ($field == 'inventory_media') { $medias = wpinventory_get_the_media(); $media = ''; foreach ((array) $medias as $m) { $media .= wpinventory_get_media_tags($m); } return $media; } if ($field == 'category_id') { $field = 'inventory_category'; } $WPIMLoop = wpinventory_get_wpim(); $value = $WPIMLoop->get_field($field); if (in_array($field, array('description', 'inventory_description'))) { return apply_filters('the_content', $value); } return $value; }