Esempio n. 1
0
function ppb_galleries_func($atts, $content)
{
    //extract short code attr
    extract(shortcode_atts(array('size' => 'one', 'title' => '', 'cat' => '', 'items' => '', 'custom_css' => ''), $atts));
    if (!is_numeric($items)) {
        $items = 3;
    }
    $return_html = '<div class="' . esc_attr($size) . ' ppb_galleries" ';
    if (!empty($custom_css)) {
        $return_html .= 'style="' . urldecode(esc_attr($custom_css)) . '" ';
    }
    $return_html .= '><div class="page_content_wrapper"><div class="inner">';
    //Display Title
    if (!empty($title)) {
        $return_html .= '<h2 class="ppb_title">' . $title . '</h2>';
    }
    //Display galleries items
    $args = array('numberposts' => $items, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => array('galleries'), 'suppress_filters' => 0);
    if (!empty($cat)) {
        $args['gallerycat'] = $cat;
    }
    $galleris_arr = get_posts($args);
    if (!empty($galleris_arr) && is_array($galleris_arr)) {
        //Check if disable slideshow hover effect
        $pp_gallery_disable_hover_slide = get_option("pp_gallery_disable_hover_slide");
        if (empty($pp_gallery_disable_hover_slide)) {
            wp_enqueue_script("jquery.cycle2.min", get_template_directory_uri() . "/js/jquery.cycle2.min.js", false, THEMEVERSION, true);
            wp_enqueue_script("custom_cycle", get_template_directory_uri() . "/js/custom_cycle.js", false, THEMEVERSION, true);
        }
        $return_html .= '<div class="blog_grid_wrapper">';
        foreach ($galleris_arr as $key => $gallery) {
            $image_url = '';
            $gallery_ID = $gallery->ID;
            if (has_post_thumbnail($gallery_ID, 'original')) {
                $image_id = get_post_thumbnail_id($gallery_ID);
                $small_image_url = wp_get_attachment_image_src($image_id, 'gallery_c', true);
            }
            $permalink_url = get_permalink($gallery_ID);
            $return_html .= '<div class="wall_entry type-post post gallery masonry element">';
            if (!empty($small_image_url[0])) {
                $all_photo_arr = array();
                if (empty($pp_gallery_disable_hover_slide)) {
                    //Get gallery images
                    $all_photo_arr = get_post_meta($gallery_ID, 'wpsimplegallery_gallery', true);
                    //Get only 5 recent photos
                    $all_photo_arr = array_slice($all_photo_arr, 0, 5);
                }
                $return_html .= '<div class="image_grid_frame">
				    <div class="wall_thumbnail post_archive">
				    	<a href="' . esc_url($permalink_url) . '" class="gallery_wrapper">
				    		<img src="' . esc_url($small_image_url[0]) . '" alt="" class="portfolio_img static"/>
				            <div class="mask transparent">
							    <div class="mask_frame">';
                if (!empty($all_photo_arr)) {
                    $return_html .= '<ul class="gallery_img_slides">';
                    foreach ($all_photo_arr as $photo) {
                        $slide_image_url = wp_get_attachment_image_src($photo, 'gallery_c', true);
                        $return_html .= '<li><img src="' . esc_url($slide_image_url[0]) . '" alt="" class="static"/></li>';
                    }
                    $return_html .= '</ul>';
                }
                $return_html .= '</div>
							</div>
						</a>
						<br class="clear"/>
						<h6>' . $gallery->post_title . '</h6>
		    			<div class="gallery_excerpt">' . strip_tags(pp_get_the_excerpt($gallery_ID)) . '</div>
				    </div>
			    </div>';
            }
            $return_html .= '</div>';
        }
        $return_html .= '</div>';
    }
    $return_html .= '</div></div>';
    $return_html .= '</div>';
    return $return_html;
}
Esempio n. 2
0
                }
                ?>
								    </ul>
								    <?php 
            }
            ?>
							    </div>
							</div>
						</a>
						<br class="clear"/>
						<h6><?php 
            echo get_the_title();
            ?>
</h6>
		    			<div class="gallery_excerpt"><?php 
            echo strip_tags(pp_get_the_excerpt($gallery_ID));
            ?>
</div>
				    </div>
			    </div>
			    <?php 
        }
        ?>
			
			</div>
			
			<?php 
        $key++;
    }
}
?>