コード例 #1
0
if (!empty($page_gallery_id)) {
    $current_page_id = $page_gallery_id;
}
//Check if password protected
$gallery_password = get_post_meta($current_page_id, 'gallery_password', true);
if (!empty($gallery_password)) {
    session_start();
    if (!isset($_SESSION['gallery_page_' . $current_page_id]) or empty($_SESSION['gallery_page_' . $current_page_id])) {
        get_template_part("/templates/template-password");
        exit;
    }
}
//Get gallery images
$all_photo_arr = get_post_meta($current_page_id, 'wpsimplegallery_gallery', true);
//Get global gallery sorting
$all_photo_arr = pp_resort_gallery_img($all_photo_arr);
global $pp_homepage_style;
$pp_homepage_style = 'wall';
get_header();
?>

<?php 
//Check if hide header on this page
$gallery_hide_header = get_post_meta($current_page_id, 'gallery_hide_header', true);
if (empty($gallery_hide_header)) {
    ?>
<div id="page_caption">
    <div id="page_caption_wrapper">
    	<div class="page_tagline">
    		<?php 
    the_excerpt();
コード例 #2
0
function tg_gallery_slider_func($atts, $content)
{
    extract(shortcode_atts(array('gallery_id' => '', 'size' => 'original', 'autoplay' => '', 'caption' => '', 'timer' => 5), $atts));
    wp_enqueue_script("flexslider-js", get_template_directory_uri() . "/js/flexslider/jquery.flexslider-min.js", false, THEMEVERSION, true);
    wp_enqueue_script("script-gallery-flexslider", get_template_directory_uri() . "/templates/script-gallery-flexslider.php?autoplay=" . $autoplay . '&amp;caption=' . $caption . '&amp;timer=' . $timer, false, THEMEVERSION, true);
    $images_arr = get_post_meta($gallery_id, 'wpsimplegallery_gallery', true);
    $images_arr = pp_resort_gallery_img($images_arr);
    $return_html = '';
    if (!empty($images_arr)) {
        $return_html .= '<div class="slider_wrapper">';
        $return_html .= '<div class="flexslider tg_gallery" data-height="750">';
        $return_html .= '<ul class="slides">';
        foreach ($images_arr as $key => $image) {
            $image_url = wp_get_attachment_image_src($image, $size, true);
            $return_html .= '<li>';
            $return_html .= '<img src="' . esc_url($image_url[0]) . '" alt=""/>';
            if (!empty($caption)) {
                //Get image meta data
                $image_caption = get_post_field('post_excerpt', $image);
                $return_html .= '<div class="gallery_image_caption">' . $image_caption . '</div>';
            }
            $return_html .= '</li>';
        }
        $return_html .= '</ul>';
        $return_html .= '</div>';
        $return_html .= '</div>';
    } else {
        $return_html .= __('Empty gallery item. Please make sure you have upload image to it or check the short code.', PLUGINDOMAIN);
    }
    return $return_html;
}
コード例 #3
0
function ppb_gallery_horizontal_func($atts, $content)
{
    //extract short code attr
    extract(shortcode_atts(array('size' => 'one', 'title' => '', 'gallery' => '', 'items' => -1, 'custom_css' => ''), $atts));
    $return_html = '<div class="' . esc_attr($size) . '" ';
    if (!empty($custom_css)) {
        $return_html .= 'style="' . urldecode(esc_attr($custom_css)) . '" ';
    }
    $return_html .= '>';
    //Get gallery images
    $all_photo_arr = get_post_meta($gallery, 'wpsimplegallery_gallery', true);
    //Get global gallery sorting
    $all_photo_arr = pp_resort_gallery_img($all_photo_arr);
    if (!empty($all_photo_arr) && is_array($all_photo_arr)) {
        $gallery_excerpt = get_post_field('post_excerpt', $gallery);
        $return_html .= '
		<div id="horizontal_gallery">
			<table id="horizontal_gallery_wrapper">
				<tbody><tr>';
        $return_html .= '
		<td style="padding:30px;">
			<div class="horizontal_gallery_info">
				<div class="page_tagline">' . $gallery_excerpt . '</div>
				<h1>' . get_the_title($gallery) . '</h1>
			</div>
		</td>';
        foreach ($all_photo_arr as $photo_id) {
            $small_image_url = '';
            $hyperlink_url = get_permalink($photo_id);
            $thumb_image_url = '';
            if (!empty($photo_id)) {
                $image_url = wp_get_attachment_image_src($photo_id, 'original', true);
            }
            //Get image meta data
            $image_caption = get_post_field('post_excerpt', $photo_id);
            $image_description = get_post_field('post_content', $photo_id);
            $pp_image_lightbox_title = get_option('pp_image_lightbox_title');
            $return_html .= '<td style="padding:30px;">';
            if (isset($image_url[0]) && !empty($image_url[0])) {
                $return_html .= '<a ';
                if (!empty($pp_image_lightbox_title)) {
                    $return_html .= 'title="';
                    if (!empty($image_caption)) {
                        $return_html .= esc_attr($image_caption);
                    }
                    $return_html .= '"';
                }
                $return_html .= 'class="fancy-gallery" href="' . esc_url($image_url[0]) . '">
			    	<div class="gallery_image_wrapper">
				    	<img src="' . esc_url($image_url[0]) . '" alt="" class="horizontal_gallery_img"/>';
                if (!empty($pp_image_lightbox_title)) {
                    $return_html .= '<div class="image_caption">' . $image_caption . '</div>
				    	<div class="image_description">' . $image_description . '</div>';
                }
                $return_html .= '</div>
	    	</a>';
            }
            $return_html .= '</td>';
        }
        $return_html .= '
				</tr></tbody>
			</table>
		</div>
		';
    }
    $return_html .= '</div>';
    return $return_html;
}
コード例 #4
0
function ppb_gallery_horizontal_func($atts, $content)
{
    //extract short code attr
    extract(shortcode_atts(array('size' => 'one', 'title' => '', 'gallery' => '', 'items' => -1, 'custom_css' => ''), $atts));
    $return_html = '<div class="' . esc_attr($size) . '" ';
    if (!empty($custom_css)) {
        $return_html .= 'style="' . urldecode(esc_attr($custom_css)) . '" ';
    }
    $return_html .= '>';
    //Get gallery images
    $all_photo_arr = get_post_meta($gallery, 'wpsimplegallery_gallery', true);
    //Get global gallery sorting
    $all_photo_arr = pp_resort_gallery_img($all_photo_arr);
    if (!empty($all_photo_arr) && is_array($all_photo_arr)) {
        //wp_enqueue_script("jquery.mousewheel", get_template_directory_uri()."/js/jquery.mousewheel.min.js", false, THEMEVERSION, true);
        wp_enqueue_script("horizontal_gallery", get_template_directory_uri() . "/js/horizontal_gallery.js", false, THEMEVERSION, true);
        $gallery_excerpt = get_post_field('post_excerpt', $gallery);
        $return_html .= '
		<div class="horizontal_gallery">
			<table class="horizontal_gallery_wrapper">
				<tbody><tr>';
        foreach ($all_photo_arr as $photo_id) {
            $small_image_url = '';
            $hyperlink_url = get_permalink($photo_id);
            $thumb_image_url = '';
            if (!empty($photo_id)) {
                $image_url = wp_get_attachment_image_src($photo_id, 'original', true);
            }
            //Get image meta data
            $image_caption = get_post_field('post_excerpt', $photo_id);
            $image_description = get_post_field('post_content', $photo_id);
            $tg_full_image_caption = kirki_get_option('tg_full_image_caption');
            $return_html .= '<td>';
            if (isset($image_url[0]) && !empty($image_url[0])) {
                $return_html .= '<a ';
                if (!empty($tg_full_image_caption)) {
                    $return_html .= 'title="';
                    if (!empty($image_caption)) {
                        $return_html .= esc_attr($image_caption);
                    }
                    $return_html .= '"';
                }
                $return_html .= 'class="fancy-gallery" href="' . esc_url($image_url[0]) . '">
			    	<div class="gallery_image_wrapper">
				    	<img src="' . esc_url($image_url[0]) . '" alt="" class="horizontal_gallery_img"/>';
                $return_html .= '</div>
	    	</a>';
                if (!empty($tg_full_image_caption)) {
                    $return_html .= '<div class="wp-caption aligncenter"><p class="wp-caption-text">' . $image_caption . '</p></div>';
                }
            }
            $return_html .= '</td>';
        }
        $return_html .= '
				</tr></tbody>
			</table>
		</div>
		';
    }
    $return_html .= '</div>';
    return $return_html;
}
コード例 #5
0
function ppb_gallery_func($atts, $content)
{
    //extract short code attr
    extract(shortcode_atts(array('size' => 'one', 'title' => '', 'gallery' => '', 'background' => '', 'custom_css' => '', 'layout' => 'fullwidth'), $atts));
    $return_html = '<div class="' . $size . ' ppb_gallery withpadding ';
    if (!empty($background)) {
        $return_html .= 'withbg';
    }
    $columns_class = 'three_cols';
    if ($layout == 'fullwidth') {
        $columns_class .= ' fullwidth';
    }
    $element_class = 'one_third gallery3';
    $return_html .= '" ';
    if (!empty($custom_css)) {
        $return_html .= 'style="' . urldecode($custom_css) . ' ';
    }
    if (!empty($background)) {
        $background = esc_url($background);
        if (!empty($custom_css)) {
            $return_html .= 'background-image: url(' . $background . ');background-attachment: fixed;background-position: center top;background-repeat: no-repeat;background-size: cover;" ';
        } else {
            $return_html .= 'style="background-image: url(' . $background . ');background-attachment: fixed;background-position: center top;background-repeat: no-repeat;background-size: cover;" ';
        }
        $return_html .= 'data-type="background" data-speed="10"';
    } else {
        $return_html .= '"';
    }
    $return_html .= '>';
    $return_html .= '<div class="page_content_wrapper ';
    if ($layout == 'fullwidth') {
        $return_html .= 'full_width';
    }
    $return_html .= '" style="text-align:center">';
    //Display Title
    if (!empty($title)) {
        $return_html .= '<h2 class="ppb_title">' . $title . '</h2>';
    }
    //Display Content
    if (!empty($content)) {
        $return_html .= '<div class="page_caption_desc">' . $content . '</div>';
    }
    //Display Horizontal Line
    if (empty($content) && !empty($title)) {
        $return_html .= '<br/><br/>';
    }
    //Get gallery images
    $all_photo_arr = get_post_meta($gallery, 'wpsimplegallery_gallery', true);
    //Get global gallery sorting
    $all_photo_arr = pp_resort_gallery_img($all_photo_arr);
    if (!empty($all_photo_arr) && is_array($all_photo_arr)) {
        $return_html .= '<div class="' . $columns_class . ' portfolio_filter_wrapper gallery section content clearfix">';
        foreach ($all_photo_arr as $key => $photo_id) {
            $small_image_url = '';
            $hyperlink_url = get_permalink($photo_id);
            if (!empty($photo_id)) {
                $image_url = wp_get_attachment_image_src($photo_id, 'original', true);
                $small_image_url = wp_get_attachment_image_src($photo_id, 'gallery_grid', true);
            }
            $last_class = '';
            if (($key + 1) % 4 == 0) {
                $last_class = 'last';
            }
            //Get image meta data
            $image_title = get_the_title($photo_id);
            $image_desc = get_post_field('post_content', $photo_id);
            $image_caption = get_post_field('post_excerpt', $photo_id);
            $return_html .= '<div class="element portfolio3filter_wrapper">';
            $return_html .= '<div class="' . $element_class . ' filterable gallery_type animated' . ($key + 1) . ' ' . $last_class . '">';
            if (!empty($small_image_url[0])) {
                $pp_lightbox_enable_title = get_option('pp_lightbox_enable_title');
                $pp_social_sharing = get_option('pp_social_sharing');
                $return_html .= '<a ';
                if (!empty($pp_lightbox_enable_title)) {
                    $return_html .= 'title="' . $image_caption . '" ';
                }
                $return_html .= 'class="fancy-gallery" href="' . $image_url[0] . '">';
                $return_html .= '<img src="' . $small_image_url[0] . '" alt="" class=""/>';
                if (!empty($pp_lightbox_enable_title) && !empty($image_caption)) {
                    $return_html .= '<div class="thumb_content">
						    	<h3>' . $image_caption . '</h3>
						    </div>
			    		';
                }
            }
            $return_html .= '</a></div></div>';
        }
        $return_html .= '</div>';
    }
    $return_html .= '</div></div>';
    return $return_html;
}