public function get_gallery_item($gallery_item) { $id = $gallery_item['attachment_id']; $image_size = get_ds_option('gallery_image_size'); if (!$image_size) { $image_size = 'full'; } $image = wp_get_attachment_image_src($id, $image_size); $out = ""; $out .= '<li>'; $out .= '<a class="gallery-item-image">' . wp_get_attachment_image($id, array(100, 100)) . '</a>'; $out .= '<a class="dsframework-remove-gallery-item" href="#" title="' . __('Remove item', 'dsframework') . '"></a>'; $out .= '<input type="hidden" value="' . $id . '" name="dsframework-gallery[attachment_ids][]" />'; $out .= '<input type="hidden" value="' . $image[0] . '" name="dsframework-gallery[attachment_urls][]" />'; $out .= '<input type="hidden" value="' . $image[1] . '" name="dsframework-gallery[attachment_widths][]" />'; $out .= '<input type="hidden" value="' . $image[2] . '" name="dsframework-gallery[attachment_heights][]" />'; $out .= '<div style="display:none;">'; $out .= '<table class="gallery-item-hidden-opts" ><tbody>'; // attachment_video_urls $out .= '<tr>'; $out .= '<td>'; $out .= '<label>' . __('Video URL (YouTube or Vimeo)', 'dsframework') . '</label>'; $out .= '</td>'; $out .= '<td>'; $out .= '<input type="text" name="dsframework-gallery[video_url][]" class="dsframework-g-item-video-url" value="' . $gallery_item['video_url'] . '" class="regular-text" />'; $out .= '</td>'; $out .= '</tr>'; // Image scale mode $img_scale = $gallery_item['single_img_scale_mode']; if (!$img_scale || $img_scale == 'default') { $f_selected = 'selected'; } else { $f_selected = ''; } $out .= '<tr>'; $out .= '<td><label for="single-image-scale-mode">' . __('Image scale mode', 'dsframework') . '</label></td>'; $out .= '<td><select id="single-image-scale-mode" name="dsframework-gallery[single_img_scale_mode][]" >'; $out .= '<option value="default" ' . $f_selected . '>' . __('Default (from gallery settings)', 'dsframework') . '</option>'; $out .= '<option value="fill" ' . selected($img_scale, 'fill', false) . '>' . __('Fill the area', 'dsframework') . '</option>'; $out .= '<option value="fit-if-smaller" ' . selected($img_scale, 'fit-if-smaller', false) . '>' . __('Fit in area', 'dsframework') . '</option>'; $out .= '<option value="none"' . selected($img_scale, 'none', false) . '>' . __('Don\'t scale', 'dsframework') . '</option>'; $out .= '</select></td>'; $out .= '</tr>'; // attachment_titles $out .= '<tr>'; $out .= '<td>'; $out .= '<label>' . __('Alt attribute', 'dsframework') . '</label>'; $out .= '</td>'; $out .= '<td>'; $out .= '<input type="text" name="dsframework-gallery[attachment_alt_attr][]" class="dsframework-g-item-alt-attr" value="' . $gallery_item['attachment_alt_attr'] . '" class="regular-text" />'; $out .= '</td>'; $out .= '</tr>'; $out .= '</tbody></table>'; $out .= '</div>'; $out .= '</li>'; return $out; }
/** * * Template Name: Masonry Gallery Page * * The template for displaying gallery page with masonry layout. * * @package dsframework * @since dsframework 1.0 * */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php $gallery_cats = get_ds_option('album_cats_gallery_page'); if ($gallery_cats) { $tax_query = array('relation' => 'AND', array('taxonomy' => 'ds-gallery-category', 'field' => 'slug', 'terms' => preg_split("/\\s*,\\s*/", $gallery_cats), 'include_children' => true, 'operator' => 'IN')); } else { $tax_query = ''; } $loop = new WP_Query(array('post_type' => 'ds-gallery', 'posts_per_page' => -1, 'tax_query' => $tax_query)); ?> <section class="albums-thumbnails clearfix"> <?php while ($loop->have_posts()) { $loop->the_post(); ?> <?php get_template_part('content', 'masonry'); ?>
<div id="page" class="hfeed site"> <?php global $data; ?> <header class="main-header"> <section class="top-logo-group"> <h1 class="logo"> <a href="<?php echo home_url('/'); ?> " title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " rel="home"> <?php $logo = get_ds_option('main_logo'); if ($logo) { echo '<img alt="' . __('home', 'dsframework') . '" src="' . $logo . '" />'; } else { echo get_bloginfo('name'); } ?> </a> </h1> <div class="site-description"><?php bloginfo('description'); ?> </div> </section> <div class="menus-container"> <span class="menu-sep">—</span>
<?php /** * The template for displaying the footer. * * Contains the closing of the id=main div and all content after * * @package dsframework * @since dsframework 1.0 */ ?> </div> <div class="push"></div> <?php // this semantics is such a boring thing ?> </div> <footer class="footer-copy"> <p><?php echo get_ds_option('footer_text'); ?> </p> </footer> </div> <?php echo get_ds_option('google_analytics'); wp_footer(); ?> </body> </html>
<?php /** * The template used for displaying data for gallery. The most important one. * * @package dsframework * @since dsframework 1.0 */ $album_data = ""; $default_img_scale_mode = get_ds_option('gallery_scale_mode'); $default_bg_color = get_ds_option('gallery_background'); if (!$default_bg_color) { $default_bg_color = 'transparent'; } $default_bg_pattern = get_ds_option('gallery_background_pattern'); if (!$default_bg_pattern) { $default_bg_pattern = 'none'; } $post_id = $post->ID; $post_meta = get_post_custom(); $gallery_meta = unserialize($post_meta['dsframework-gallery'][0]); $j = 0; if (isset($gallery_meta['attachment_urls'])) { $image_urls = $gallery_meta['attachment_urls']; } else { $image_urls = 0; } if (isset($gallery_meta['attachment_widths'])) { $image_widths = $gallery_meta['attachment_widths']; } else { $image_widths = 0;
/** * Enqueue scripts and styles */ function dsframework_scripts() { global $post; // todo: optimize this part if (!is_admin()) { if (USE_LESS_CSS) { $style_name = get_ds_option('alt_stylesheet'); if (!$style_name) { $style_name = 'style-touchfolio-default'; } wp_enqueue_style('style', get_bloginfo('template_directory') . '/' . $style_name, array(), '', 'screen, projection'); } else { wp_enqueue_style('style', get_stylesheet_uri()); } wp_enqueue_script('jquery'); if (is_page_template('ds-gallery-masonry-template.php')) { wp_enqueue_script('jquery.masonry', DS_THEME_PATH . '/js/jquery.masonry.min.js'); } else { wp_enqueue_script('jquery.two-dimensional-slider', DS_THEME_PATH . '/js/jquery.slider-pack.1.1.min.js'); wp_localize_script('jquery.two-dimensional-slider', 'tdSliderVars', array('nextAlbum' => __('Next project', 'dsframework'), 'prevAlbum' => __('Prev project', 'dsframework'), 'closeProjectInfo' => __('close info', 'dsframework'), 'holdAndDrag' => __('Click and drag in any direction to browse.', 'dsframework'), 'nextImage' => __('Next image', 'dsframework'), 'closeVideo' => __('close video', 'dsframework'), 'prevImage' => __('Prev image', 'dsframework'), 'backToList' => __('← back to list', 'dsframework'), 'swipeUp' => __('Swipe up', 'dsframework'), 'swipeDown' => __('Swipe down', 'dsframework'), 'autoOpenProjectDesc' => get_ds_option('auto_open_project_desc'))); } if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('main-theme-js', DS_THEME_PATH . '/js/main.js'); wp_localize_script('main-theme-js', 'dsframework_vars', array('select_menu_text' => __('— Select page —', 'dsframework'), 'social_menu_text' => __('—', 'dsframework'), 'menu_text' => __('menu', 'dsframework'))); } }