/** * Callback for g1_mediabox custom action hook * * @param string $size Image size * @param string $type Mediabox type */ public function mediabox($args) { extract($args); if (!in_array($type, array('simple_slider', 'simple-slider'))) { return; } global $post; /* Standard Media */ $items = g1_mediabox_items($post->ID, $size); $items_html = ''; if (count($items) > 0) { /* Items */ foreach ($items as $index => $item) { $class = array_merge(array($index % 2 ? 'even' : 'odd'), $item['class']); $items_html .= '<li class="' . sanitize_html_classes($class) . '">' . $item['html'] . '</li>'; } /* Thumbnails */ $items = g1_mediabox_thumbs($post->ID, 'g1_one_twelfth'); $thumbs_html = ''; foreach ($items as $index => $item) { $thumbs_html .= '<li class="' . sanitize_html_classes($item['class']) . '">' . $item['html'] . '</li>'; } /* Lightbox data */ $items = g1_mediabox_lightbox($post->ID, 'full'); $lightbox_html = ''; foreach ($items as $index => $item) { $lightbox_html .= '<li class="' . sanitize_html_classes($item['class']) . '">' . $item['html'] . '</li>'; } } else { if ($force_placeholder) { echo do_shortcode('[placeholder icon="eye-close" size="' . esc_attr($size) . '"]'); } } /* Compose final template */ $out = '<figure class="g1-mediabox g1-mediabox--slider" data-config="' . g1_data_capture($this->get_default_config()) . '">' . '<div class="g1-inner">' . '<ol class="g1-slides">' . $items_html . '</ol>' . '<ol class="g1-nav-coin">' . $thumbs_html . '</ol>' . '<ol class="g1-lightbox-data">' . $lightbox_html . '</ol>' . '</div>' . '</figure>'; echo $out; }
* * For the full license information, please view the Licensing folder * that was distributed with this source code. * * @package G1_Framework * @subpackage G1_Theme03 * @since G1_Theme03 1.0.0 */ // Prevent direct script access if (!defined('ABSPATH')) { die('No direct script access allowed'); } $g1_data = g1_part_get_data(); $g1_size = $g1_data['size']; $g1_force_placeholder = $g1_data['force_placeholder']; $g1_mediabox_items = g1_mediabox_items($post->ID, $g1_data['size'], true); $g1_mediabox_lightbox = g1_mediabox_lightbox($post->ID, 'full', true); global $post; // Get attachment (the featured image to be exact) object $g1_attachment = get_post(absint(get_post_thumbnail_id($post->ID))); ?> <?php if (count($g1_mediabox_items) > 0) { ?> <?php /* Executes a custom hook. * If you want to add some content before a mediabox * hook into the 'g1_mediabox_before' action. */ do_action('g1_mediabox_before');