function mtphr_gallery_add_directional_nav($post_id, $meta_data) { $settings = mtphr_galleries_settings(); // Extract the metadata array into variables extract($meta_data); $directional_nav = $settings['global_slider_settings'] == 'on' ? $settings['slider_directional_nav'] == 'on' : isset($_mtphr_gallery_slider_directional_nav) && $_mtphr_gallery_slider_directional_nav; $resources = mtphr_gallery_resource_meta($post_id); if (is_array($resources) && count($resources) > 1) { $html = ''; if ($directional_nav) { $html .= '<a href="#" class="mtphr-gallery-nav-prev" rel="nofollow">' . apply_filters('mtphr_gallery_navigation_previous', __('Previous', 'mtphr-galleries')) . '</a>'; $html .= '<a href="#" class="mtphr-gallery-nav-next" rel="nofollow">' . apply_filters('mtphr_gallery_navigation_next', __('Next', 'mtphr-galleries')) . '</a>'; } echo $html; } }
function get_mtphr_gallery_thumbnail($post_id = false, $width = false, $height = false) { $post_id = $post_id ? $post_id : get_the_id(); // Return the featured image thumbnail if ($att_id = get_post_thumbnail_id($post_id)) { return wp_get_attachment_image($att_id, apply_filters('mtphr_galleries_thumbnail_size', 'thumbnail')); } else { // Return the first attachment thumbnail $resources = mtphr_gallery_resource_meta($post_id); if (is_array($resources) && isset($resources[0])) { if (is_array($resources[0])) { return get_mtphr_gallery_resource_thumbnail($resources[0]); } else { return mtphr_galleries_thumbnail($resources[0], false, false, apply_filters('mtphr_galleries_thumbnail_size', 'thumbnail')); } } } return false; }
/** * Return the gallery resources * * @since 1.0.0 */ function get_mtphr_gallery_resources($post_id = false, $width = false, $height = false) { $post_id = $post_id ? $post_id : get_the_id(); $resources = mtphr_gallery_resource_meta($post_id); if (is_array($resources) && isset($resources[0])) { $gallery = '<div class="mtphr-gallery-resource-container">'; foreach ($resources as $i => $resource) { $resource = apply_filters('mtphr_galleries_resource_data', $resource); $div = '<div id="mtphr-gallery-resource-' . $i . '" class="mtphr-gallery-resource mtphr-gallery-resource-' . $resource['type'] . '">'; $div .= get_mtphr_gallery_resource($resource, $width, $height); $div .= '</div>'; $gallery .= apply_filters('mtphr_gallery_resource', $div, $resource, $width, $height, $post_id); } $gallery .= '</div>'; return $gallery; } return false; }