当前位置: 首页>>代码示例>>PHP>>正文


PHP presscore_get_share_buttons_for_prettyphoto函数代码示例

本文整理汇总了PHP中presscore_get_share_buttons_for_prettyphoto函数的典型用法代码示例。如果您正苦于以下问题:PHP presscore_get_share_buttons_for_prettyphoto函数的具体用法?PHP presscore_get_share_buttons_for_prettyphoto怎么用?PHP presscore_get_share_buttons_for_prettyphoto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了presscore_get_share_buttons_for_prettyphoto函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: shortcode

 public function shortcode($atts, $content = null)
 {
     $attributes = $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', LANGUAGE_ZONE);
         $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
         return $this->vc_inline_dummy(array('class' => 'dt_vc-photos_masonry', 'title' => _x('Photos masonry', 'vc inline dummy', LANGUAGE_ZONE), 'fields' => array($terms_title => $terms_list)));
     }
     $output = '';
     $dt_query = $this->get_albums_attachments(array('orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'number' => $attributes['number'], 'select' => $attributes['select'], 'category' => $attributes['category']));
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config($attributes);
         ob_start();
         do_action('presscore_before_shortcode_loop', $this->shortcode_name, $attributes);
         // masonry container open
         echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-gallery-container', 'dt-photos-shortcode')) . presscore_masonry_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             dt_get_template_part('media/media-masonry-post');
         }
         // masonry container close
         echo '</div>';
         do_action('presscore_after_shortcode_loop', $this->shortcode_name, $attributes);
         $output = ob_get_contents();
         ob_end_clean();
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
开发者ID:noman90rauf,项目名称:wp-content,代码行数:33,代码来源:photos-masonry.php

示例2: shortcode_html

 protected function shortcode_html()
 {
     $dt_query = $this->get_albums_attachments(array('orderby' => $this->atts['orderby'], 'order' => $this->atts['order'], 'number' => $this->atts['number'], 'select' => $this->atts['select'], 'category' => $this->atts['category']));
     $output = '';
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config();
         ob_start();
         do_action('presscore_before_shortcode_loop', $this->shortcode_name, $this->atts);
         // masonry container open
         echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-gallery-container', 'dt-photos-shortcode')) . presscore_masonry_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             dt_get_template_part('media/media-masonry-post');
         }
         // masonry container close
         echo '</div>';
         do_action('presscore_after_shortcode_loop', $this->shortcode_name, $this->atts);
         $output = ob_get_contents();
         ob_end_clean();
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
开发者ID:armslee,项目名称:wp_requid,代码行数:26,代码来源:photos-jgrid.php

示例3: shortcode

        public function shortcode($atts, $content = null)
        {
            $attributes = $this->sanitize_attributes($atts);
            if (presscore_vc_is_inline()) {
                $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
                $dummy = '
					<div class="dt_vc-shortcode_dummy dt_vc-photos_scroller" style="height: ' . $slider_args['height'] . 'px;">
						<h5>Photos scroller</h5>
						<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
					</div>
				';
                return $dummy;
            }
            $attachments_ids = array();
            // get albums
            $dt_query = $this->get_posts_by_terms(array_merge($attributes, array('number' => -1)));
            if ($dt_query->have_posts()) {
                // take albums id
                foreach ($dt_query->posts as $dt_post) {
                    $album_attachments = get_post_meta($dt_post->ID, '_dt_album_media_items', true);
                    if ($album_attachments) {
                        $attachments_ids = array_merge($attachments_ids, $album_attachments);
                    }
                }
            }
            if ('rand' == $attributes['orderby']) {
                shuffle($attachments_ids);
            }
            // new query to take attachments
            $attachments_data = presscore_get_attachment_post_data($attachments_ids, 'post__in', 'DESC', $attributes['number']);
            $config = Presscore_Config::get_instance();
            $slider_class = array('shortcode-instagram');
            if ('disabled' == $config->get('sidebar_position')) {
                $slider_class[] = 'full';
            }
            $slider_style = array();
            if ($attributes['margin_bottom']) {
                $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom'];
            }
            if ($attributes['margin_top']) {
                $slider_style[] = 'margin-top: ' . $attributes['margin_top'];
            }
            $slider_fields = array();
            /*if ( $attributes['arrows'] ) {
            			$slider_fields[] = 'arrows';
            		}*/
            $sharebuttons = presscore_get_share_buttons_for_prettyphoto('photo');
            $slider_args = array('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'link' => $attributes['lightbox'] ? 'file' : 'none', 'popup' => $attributes['lightbox'] ? 'gallery' : 'none', 'container_attr' => $sharebuttons);
            /*if ( $attributes['slider_title'] ) {
            			$slider_args['title'] = $attributes['slider_title'];
            		}*/
            if ($attributes['height']) {
                $slider_args['height'] = $attributes['height'];
            }
            if ($attributes['width']) {
                $slider_args['img_width'] = $attributes['width'];
            }
            $output = presscore_get_fullwidth_slider_two($attachments_data, $slider_args);
            return $output;
        }
开发者ID:noman90rauf,项目名称:wp-content,代码行数:60,代码来源:small-photos.php

示例4: shortcode

 public function shortcode($atts, $content = null)
 {
     $attributes = $this->atts = $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', 'the7mk2');
         $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
         return $this->vc_inline_dummy(array('class' => 'dt_vc-photos_scroller', 'title' => _x('Photos scroller', 'vc inline dummy', 'the7mk2'), 'fields' => array($terms_title => $terms_list)));
     }
     $output = '';
     $dt_query = $this->get_albums_attachments(array('orderby' => $attributes['orderby'], 'order' => 'DESC', 'number' => $attributes['number'], 'select' => $attributes['select'], 'category' => $attributes['category']));
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config();
         $this->add_hooks();
         ob_start();
         // loop
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             echo '<li class="fs-entry">';
             dt_get_template_part('media/media-masonry-post');
             echo '</li>';
         }
         $posts_html = ob_get_contents();
         ob_end_clean();
         // shape output
         $output = '<div ' . $this->get_container_html_class(array('dt-photos-shortcode', 'slider-wrapper', 'shortcode-instagram', 'dt-gallery-container')) . ' ' . $this->get_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
         $output .= '<div class="frame fullwidth-slider"><ul class="clearfix">' . $posts_html . '</ul></div>';
         if ($attributes['arrows']) {
             $output .= '<div class="prev"><i></i></div><div class="next"><i></i></div>';
         }
         $output .= '</div>';
         // cleanup
         $this->remove_hooks();
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
开发者ID:armslee,项目名称:wp_requid,代码行数:40,代码来源:photos-slider.php

示例5: the_ID

<article id="post-<?php 
the_ID();
?>
" <?php 
post_class('post');
?>
>

	<?php 
if (!post_password_required() && $attachments_data) {
    reset($attachments_data);
    $hidden_gallery = '';
    $title_image = current($attachments_data);
    $link_class = 'link show-content alignleft rollover';
    $link_custom = $style;
    $share_buttons = presscore_get_share_buttons_for_prettyphoto('photo');
    $title_args = array('img_meta' => array($title_image['full'], $title_image['width'], $title_image['height']), 'img_id' => $title_image['ID'], 'class' => $link_class, 'custom' => $link_custom . ' data-dt-img-description="' . esc_attr($title_image['description']) . '"', 'echo' => false, 'wrap' => '<a %HREF% %CLASS% %CUSTOM% %TITLE%><img %IMG_CLASS% %SRC% %IMG_TITLE% %ALT% %SIZE% /></a>');
    if (count($attachments_data) == 1) {
        $title_args['custom'] .= $share_buttons;
        $title_args['class'] .= ' dt-single-mfp-popup dt-mfp-item';
    } else {
        $title_args['class'] .= ' dt-gallery-mfp-popup';
    }
    if ($title_image['video_url']) {
        $title_args['class'] .= ' mfp-iframe';
        $title_args['href'] = $title_image['video_url'];
    } else {
        $title_args['class'] .= ' mfp-image';
    }
    $media = dt_get_thumb_img($title_args);
    if (count($attachments_data) > 1) {
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:31,代码来源:content-archive-gallery.php

示例6: presscore_get_images_gallery_hoovered

 /**
  * Hoovered gallery.
  *
  * @param array $attachments_data Attachments data array.
  * @param array $options Gallery options.
  *
  * @return string HTML.
  */
 function presscore_get_images_gallery_hoovered($attachments_data, $options = array())
 {
     if (empty($attachments_data)) {
         return '';
     }
     // clear attachments_data
     foreach ($attachments_data as $index => $data) {
         if (empty($data['full'])) {
             unset($attachments_data[$index]);
         }
     }
     unset($data);
     if (empty($attachments_data)) {
         return '';
     }
     static $gallery_counter = 0;
     $gallery_counter++;
     $id_mark_prefix = 'pp-gallery-hoovered-media-content-' . $gallery_counter . '-';
     $default_options = array('echo' => false, 'class' => array(), 'links_rel' => '', 'style' => '', 'share_buttons' => false, 'exclude_cover' => false, 'title_img_options' => array(), 'title_image_args' => array(), 'attachments_count' => null, 'show_preview_on_hover' => true, 'video_icon' => true);
     $options = wp_parse_args($options, $default_options);
     $class = implode(' ', (array) $options['class']);
     $small_images = array_slice($attachments_data, 1);
     $big_image = current($attachments_data);
     if (!is_array($options['attachments_count']) || count($options['attachments_count']) < 2) {
         $attachments_count = presscore_get_attachments_data_count($options['exclude_cover'] ? $small_images : $attachments_data);
     } else {
         $attachments_count = $options['attachments_count'];
     }
     list($images_count, $videos_count) = $attachments_count;
     $count_text = array();
     if ($images_count) {
         $count_text[] = sprintf(_n('1 image', '%s images', $images_count, LANGUAGE_ZONE), $images_count);
     }
     if ($videos_count) {
         $count_text[] = sprintf(__('%s video', LANGUAGE_ZONE), $videos_count);
     }
     $count_text = implode(',&nbsp;', $count_text);
     $image_args = array('img_class' => 'preload-me', 'class' => $class, 'custom' => implode(' ', array($options['links_rel'], $options['style'])), 'echo' => false);
     $image_hover = '';
     $mini_count = 3;
     $html = '';
     $share_buttons = '';
     if ($options['share_buttons']) {
         $share_buttons = presscore_get_share_buttons_for_prettyphoto('photo');
     }
     // medium images
     if (!empty($small_images)) {
         $html .= '<div class="dt-gallery-container mfp-hide"' . $share_buttons . '>';
         foreach ($attachments_data as $key => $data) {
             if ($options['exclude_cover'] && 0 == $key) {
                 continue;
             }
             $small_image_args = array('img_meta' => $data['thumbnail'], 'img_id' => empty($data['ID']) ? $data['ID'] : 0, 'alt' => $data['title'], 'title' => $data['description'], 'href' => esc_url($data['full']), 'custom' => '', 'class' => 'mfp-image');
             if ($options['share_buttons']) {
                 $small_image_args['custom'] = 'data-dt-location="' . esc_attr($data['permalink']) . '" ';
             }
             $mini_image_args = array('img_meta' => $data['thumbnail'], 'img_id' => empty($data['ID']) ? $data['ID'] : 0, 'alt' => $data['title'], 'title' => $data['description'], 'wrap' => '<img %IMG_CLASS% %SRC% %ALT% %IMG_TITLE% width="90" />');
             if ($mini_count && !(!$options['exclude_cover'] && 0 == $key) && $options['show_preview_on_hover']) {
                 $image_hover = '<span class="r-thumbn-' . $mini_count . '">' . dt_get_thumb_img(array_merge($image_args, $mini_image_args)) . '<i>' . $count_text . '</i></span>' . $image_hover;
                 $mini_count--;
             }
             if (!empty($data['video_url'])) {
                 $small_image_args['href'] = $data['video_url'];
                 $small_image_args['class'] = 'mfp-iframe';
             }
             $html .= sprintf('<a href="%s" title="%s" class="%s" data-dt-img-description="%s" %s></a>', esc_url($small_image_args['href']), esc_attr($small_image_args['alt']), esc_attr($small_image_args['class'] . ' dt-mfp-item'), esc_attr($small_image_args['title']), $small_image_args['custom']);
         }
         $html .= '</div>';
     }
     unset($image);
     if ($image_hover && $options['show_preview_on_hover']) {
         $image_hover = '<span class="rollover-thumbnails">' . $image_hover . '</span>';
     }
     // big image
     $big_image_args = array('img_meta' => array($big_image['full'], $big_image['width'], $big_image['height']), 'img_id' => empty($big_image['ID']) ? $big_image['ID'] : 0, 'wrap' => '<a %HREF% %CLASS% %CUSTOM% %IMG_TITLE%><img %SRC% %IMG_CLASS% %ALT% %IMG_TITLE% %SIZE% />' . $image_hover . '</a>', 'alt' => $big_image['alt'], 'title' => $big_image['title'], 'class' => $class, 'options' => $options['title_img_options']);
     if (empty($small_images)) {
         $big_image_args['custom'] = ' data-dt-img-description="' . esc_attr($big_image['description']) . '"' . $share_buttons;
         if ($options['share_buttons']) {
             $big_image_args['custom'] = ' data-dt-location="' . esc_attr($big_image['permalink']) . '"' . $big_image_args['custom'];
         }
         $big_image_args['class'] .= ' dt-single-mfp-popup dt-mfp-item mfp-image';
     } else {
         $big_image_args['custom'] = $image_args['custom'];
         $big_image_args['class'] .= ' dt-gallery-mfp-popup';
     }
     $big_image_args = apply_filters('presscore_get_images_gallery_hoovered-title_img_args', $big_image_args, $image_args, $options, $big_image);
     if ($options['video_icon'] && !empty($big_image['video_url']) && !$options['exclude_cover']) {
         $big_image_args['href'] = $big_image['video_url'];
         $blank_image = presscore_get_blank_image();
         $video_link_classes = 'video-icon';
         if (empty($small_images)) {
             $video_link_classes .= ' mfp-iframe dt-single-mfp-popup dt-mfp-item';
//.........这里部分代码省略.........
开发者ID:scottnkerr,项目名称:eeco,代码行数:101,代码来源:helpers.php

示例7: while

 if (have_posts()) {
     while (have_posts()) {
         the_post();
         // main loop
         do_action('presscore_before_loop');
         if (post_password_required()) {
             the_content();
         } else {
             // backup config
             $config_backup = $config->get();
             // fullwidth wrap open
             if ($config->get('full_width')) {
                 echo '<div class="full-width-wrap">';
             }
             // masonry container open
             echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-gallery-container')) . presscore_masonry_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
             //////////////////////
             // Custom loop //
             //////////////////////
             if (function_exists('presscore_mod_albums_get_photos')) {
                 $page_query = presscore_mod_albums_get_photos();
                 if ($page_query->have_posts()) {
                     while ($page_query->have_posts()) {
                         $page_query->the_post();
                         presscore_get_template_part('mod_albums', 'photo-masonry/photo');
                     }
                     wp_reset_postdata();
                 }
             }
             // masonry container close
             echo '</div>';
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:31,代码来源:template-media-jgrid.php

示例8: array_unshift

 }
 // if we have post thumbnail and it's not hidden
 if (has_post_thumbnail() && $config->get('post.media.featured_image.enabled')) {
     array_unshift($media_items, absint(get_post_thumbnail_id()));
 }
 // open in lightbox
 $open_thumbnail_in_lightbox = $config->get('post.media.lightbox.enabled');
 $media_type = $config->get('post.media.type');
 $attachments_data = presscore_get_attachment_post_data($media_items);
 if (count($attachments_data) > 1) {
     // media html
     switch ($media_type) {
         case 'gallery':
             $gallery_columns = absint($config->get('post.media.gallery.columns'));
             $gallery_columns = $gallery_columns ? $gallery_columns : 4;
             $media_html = presscore_get_images_gallery_1($attachments_data, array('columns' => $gallery_columns, 'first_big' => $config->get('post.media.gallery.first_iamge_is_large'), 'style' => presscore_get_share_buttons_for_prettyphoto('photo')));
             break;
         case 'list':
             $media_html = presscore_get_images_list($attachments_data, array('open_in_lightbox' => $open_thumbnail_in_lightbox, 'show_share_buttons' => true));
             break;
         default:
             // slideshow dimensions
             $slider_proportions = $config->get('post.media.slider.proportion');
             if (!is_array($slider_proportions)) {
                 $slider_proportions = array('width' => '', 'height' => '');
             }
             $slider_proportions = wp_parse_args($slider_proportions, array('width' => '', 'height' => ''));
             $media_html = presscore_get_royal_slider($attachments_data, array('class' => array('slider-post'), 'width' => absint($slider_proportions['width']), 'height' => absint($slider_proportions['height']), 'style' => ' style="width: 100%;"', 'show_info' => array('title', 'link', 'description', 'share_buttons')));
     }
     if ($media_html && in_array($media_type, array('list', 'gallery'))) {
         $media_html = sprintf('<div class="images-container">%s</div>', $media_html);
开发者ID:noman90rauf,项目名称:wp-content,代码行数:31,代码来源:albums-post-single-media.php

示例9: shortcode

 public function shortcode($atts, $content = null)
 {
     $attributes = shortcode_atts(array('category' => '', 'number' => '6', 'orderby' => 'recent', 'height' => '270', 'margin_top' => '', 'margin_bottom' => '', 'width' => '', 'lightbox' => ''), $atts);
     // sanitize attributes
     $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']);
     $attributes['orderby'] = in_array($attributes['orderby'], array('recent', 'random')) ? $attributes['orderby'] : 'recent';
     $attributes['height'] = absint($attributes['height']);
     $attributes['width'] = absint($attributes['width']);
     $attributes['margin_top'] = $attributes['margin_top'] ? intval($attributes['margin_top']) . 'px' : '';
     $attributes['margin_bottom'] = $attributes['margin_bottom'] ? intval($attributes['margin_bottom']) . 'px' : '';
     // $attributes['arrows'] = apply_filters('dt_sanitize_flag', $attributes['arrows']);
     $attributes['lightbox'] = apply_filters('dt_sanitize_flag', $attributes['lightbox']);
     // $attributes['slider_title'] = wp_kses($content, array());
     if ('recent' == $attributes['orderby']) {
         $attributes['orderby'] = 'date';
     } elseif ('random' == $attributes['orderby']) {
         $attributes['orderby'] = 'rand';
     }
     if ($attributes['category']) {
         $attributes['category'] = explode(',', $attributes['category']);
         $attributes['category'] = array_map('trim', $attributes['category']);
         $attributes['select'] = 'only';
     } else {
         $attributes['select'] = 'all';
     }
     $attachments_ids = array();
     // get albums
     $dt_query = $this->get_posts_by_terms(array_merge($attributes, array('number' => -1)));
     if ($dt_query->have_posts()) {
         // take albums id
         foreach ($dt_query->posts as $dt_post) {
             $album_attachments = get_post_meta($dt_post->ID, '_dt_album_media_items', true);
             if ($album_attachments) {
                 $attachments_ids = array_merge($attachments_ids, $album_attachments);
             }
         }
     }
     // new query to take attachments
     $attachments_data = presscore_get_attachment_post_data($attachments_ids, 'post__in', 'DESC', $attributes['number']);
     $config = Presscore_Config::get_instance();
     $slider_class = array('shortcode-instagram');
     if ('disabled' == $config->get('sidebar_position')) {
         $slider_class[] = 'full';
     }
     $slider_style = array();
     if ($attributes['margin_bottom']) {
         $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom'];
     }
     if ($attributes['margin_top']) {
         $slider_style[] = 'margin-top: ' . $attributes['margin_top'];
     }
     $slider_fields = array();
     /*if ( $attributes['arrows'] ) {
     			$slider_fields[] = 'arrows';
     		}*/
     $sharebuttons = presscore_get_share_buttons_for_prettyphoto('photo');
     $slider_args = array('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'link' => $attributes['lightbox'] ? 'file' : 'none', 'popup' => $attributes['lightbox'] ? 'gallery' : 'none', 'container_attr' => $sharebuttons);
     /*if ( $attributes['slider_title'] ) {
     			$slider_args['title'] = $attributes['slider_title'];
     		}*/
     if ($attributes['height']) {
         $slider_args['height'] = $attributes['height'];
     }
     if ($attributes['width']) {
         $slider_args['img_width'] = $attributes['width'];
     }
     $output = presscore_get_fullwidth_slider_two($attachments_data, $slider_args);
     return $output;
 }
开发者ID:scottnkerr,项目名称:eeco,代码行数:69,代码来源:functions.php

示例10: widget

 function widget($args, $instance)
 {
     static $number = 0;
     $number++;
     extract($args);
     $instance = wp_parse_args((array) $instance, self::$widget_defaults);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title']);
     // get albums from selected categories
     $args = array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats'])));
     switch ($instance['select']) {
         case 'only':
             $args['tax_query'][0]['operator'] = 'IN';
             break;
         case 'except':
             $args['tax_query'][0]['operator'] = 'NOT IN';
             break;
         default:
             unset($args['tax_query']);
     }
     $p_query = new WP_Query($args);
     $attachments_ids_array = array();
     // get attachments id
     if ($p_query->have_posts()) {
         foreach ($p_query->posts as $album) {
             // get saved data, hope it's array
             $attachments = get_post_meta($album->ID, '_dt_album_media_items', true);
             if (!$attachments) {
                 continue;
             }
             $attachments_ids_array = array_merge($attachments_ids_array, (array) $attachments);
         }
     }
     $attachments_ids_array = array_unique($attachments_ids_array);
     $a_query = false;
     if ($attachments_ids_array) {
         if ('menu_order' == $instance['orderby']) {
             $instance['orderby'] = 'post__in';
             if ('DESC' == $instance['order']) {
                 krsort($attachments_ids_array);
                 $attachments_ids_array = array_values($attachments_ids_array);
             }
         }
         $a_query = new WP_Query(array('posts_per_page' => $instance['show'], 'no_found_rows' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'post__in' => $attachments_ids_array, 'order' => $instance['order'], 'orderby' => $instance['orderby']));
     }
     echo $before_widget . "\n";
     // title
     if ($title) {
         echo $before_title . $title . $after_title . "\n";
     }
     if ($a_query && $a_query->have_posts()) {
         $share_buttons = presscore_get_share_buttons_for_prettyphoto('photo');
         echo '<div class="instagram-photos dt-gallery-container"' . $share_buttons . '>' . "\n";
         while ($a_query->have_posts()) {
             $a_query->the_post();
             $post_id = get_the_ID();
             $thumb_meta = wp_get_attachment_image_src($post_id, 'full');
             $img = dt_get_thumb_img(array('img_meta' => $thumb_meta, 'img_id' => $post_id, 'class' => 'rollover rollover-small dt-mfp-item mfp-image', 'options' => array('w' => 90, 'h' => 90), 'wrap' => "\n" . '<a %HREF% %CLASS% %CUSTOM% title="%RAW_ALT%" data-dt-img-description="%RAW_TITLE%" data-dt-location="' . esc_attr(get_permalink($post_id)) . '"><img %IMG_CLASS% %SRC% %SIZE% %ALT% /></a>' . "\n"));
         }
         wp_reset_postdata();
         echo '</div>' . "\n";
     }
     // if have posts
     echo $after_widget . "\n";
 }
开发者ID:scottnkerr,项目名称:eeco,代码行数:65,代码来源:photos.php

示例11: shortcode

    public function shortcode($atts, $content = null)
    {
        $attributes = shortcode_atts(array('category' => '', 'number' => '6', 'orderby' => 'recent', 'height' => '270', 'margin_top' => '', 'margin_bottom' => '', 'width' => '', 'lightbox' => ''), $atts);
        // sanitize attributes
        $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']);
        $attributes['orderby'] = in_array($attributes['orderby'], array('recent', 'random')) ? $attributes['orderby'] : 'recent';
        $attributes['height'] = absint($attributes['height']);
        $attributes['width'] = absint($attributes['width']);
        $attributes['margin_top'] = $attributes['margin_top'] ? intval($attributes['margin_top']) . 'px' : '';
        $attributes['margin_bottom'] = $attributes['margin_bottom'] ? intval($attributes['margin_bottom']) . 'px' : '';
        // $attributes['arrows'] = apply_filters('dt_sanitize_flag', $attributes['arrows']);
        $attributes['lightbox'] = apply_filters('dt_sanitize_flag', $attributes['lightbox']);
        // $attributes['slider_title'] = wp_kses($content, array());
        if ('recent' == $attributes['orderby']) {
            $attributes['orderby'] = 'date';
        } elseif ('random' == $attributes['orderby']) {
            $attributes['orderby'] = 'rand';
        }
        if ($attributes['category']) {
            $attributes['category'] = explode(',', $attributes['category']);
            $attributes['category'] = array_map('trim', $attributes['category']);
            $attributes['select'] = 'only';
        } else {
            $attributes['select'] = 'all';
        }
        $attachments_ids = array();
        // get albums
        $dt_query = $this->get_posts_by_terms(array_merge($attributes, array('number' => -1)));
        if ($dt_query->have_posts()) {
            // take albums id
            foreach ($dt_query->posts as $dt_post) {
                $album_attachments = get_post_meta($dt_post->ID, '_dt_album_media_items', true);
                if ($album_attachments) {
                    $attachments_ids = array_merge($attachments_ids, $album_attachments);
                }
            }
        }
        if ('rand' == $attributes['orderby']) {
            shuffle($attachments_ids);
        }
        // new query to take attachments
        $attachments_data = presscore_get_attachment_post_data($attachments_ids, 'post__in', 'DESC', $attributes['number']);
        $config = Presscore_Config::get_instance();
        $slider_class = array('shortcode-instagram');
        $slider_style = array();
        if ($attributes['margin_bottom']) {
            $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom'];
        }
        if ($attributes['margin_top']) {
            $slider_style[] = 'margin-top: ' . $attributes['margin_top'];
        }
        $slider_fields = array();
        /*if ( $attributes['arrows'] ) {
        			$slider_fields[] = 'arrows';
        		}*/
        $sharebuttons = presscore_get_share_buttons_for_prettyphoto('photo');
        $slider_args = array('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'link' => $attributes['lightbox'] ? 'file' : 'none', 'popup' => $attributes['lightbox'] ? 'gallery' : 'none', 'container_attr' => $sharebuttons);
        /*if ( $attributes['slider_title'] ) {
        			$slider_args['title'] = $attributes['slider_title'];
        		}*/
        if ($attributes['height']) {
            $slider_args['height'] = $attributes['height'];
        }
        if ($attributes['width']) {
            $slider_args['img_width'] = $attributes['width'];
        }
        $output = presscore_get_fullwidth_slider_two($attachments_data, $slider_args);
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_gallery_category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-photos_scroller" style="height: ' . $slider_args['height'] . 'px;">
					<h5>Photos scroller</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }
开发者ID:szpaddy,项目名称:the7,代码行数:78,代码来源:functions.php


注:本文中的presscore_get_share_buttons_for_prettyphoto函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。