function start_attach_gallery_to_post($post_id)
 {
     //Clear any foogallery css that the post might need to include
     delete_post_meta($post_id, FOOGALLERY_META_POST_USAGE_CSS);
     //create an instance of the template loader that we will use to find CSS files that the different FooGalleries will require to be loaded
     $template_loader = new FooGallery_Template_Loader();
     $this->_locator = $template_loader->create_locator_instance();
 }
Example #2
0
 function render_foogallery_shortcode($atts)
 {
     $args = wp_parse_args($atts, array('id' => 0, 'gallery' => ''));
     $args = apply_filters('foogallery_shortcode_atts', $args);
     //create new instance of template engine
     $engine = new FooGallery_Template_Loader();
     ob_start();
     $engine->render_template($args);
     $output_string = ob_get_contents();
     ob_end_clean();
     return $output_string;
 }
/**
 * Render a foogallery
 *
 * @param $gallery_id int The id of the foogallery you want to render
 */
function foogallery_render_gallery($gallery_id)
{
    //create new instance of template engine
    $engine = new FooGallery_Template_Loader();
    $engine->render_template(array('id' => $gallery_id));
}
Example #4
0
$data['next'] = $next;
$data['special'] = $special;
$data['images'] = array();
//hacking, not good slaven
if ($id == 3) {
    $fieldId = $id . "_fotografija";
    $image = get_field($fieldId);
    $data['images'] = array(get_image_from_custom_field($image, 'gallery_slider'));
}
switch (get_field($id . '_slider_choice')) {
    case 'Slider':
        $fieldId = $id . "_slider";
        $sliderPage = get_field($fieldId);
        $post = get_post($sliderPage);
        if (is_numeric($sliderPage) && $sliderPage > 0) {
            $fg = new FooGallery_Template_Loader();
            $gallery = $fg->find_gallery(array('id' => $sliderPage));
            $images = array();
            foreach ($gallery->attachments() as $attach) {
                if ($current > $numberOfImages) {
                    break;
                }
                $current++;
                $img = wp_get_attachment_image_src($attach->ID, 'gallery_slider');
                $images[] = $img[0];
            }
            $data['images'] = $images;
        }
        break;
    case 'Fotografija':
        $fieldId = $id . "_fotografija";
Example #5
0
 */
get_header();
the_post();
$type = 'foogallery';
$args = array('post_type' => $type, 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'id', 'order' => 'ASC');
$my_query = null;
$my_query = new WP_Query($args);
$sections = array();
if ($my_query->have_posts()) {
    while ($my_query->have_posts()) {
        $my_query->the_post();
        $data['title'] = get_the_title();
        $data['description'] = get_field('opis');
        $data['images'] = array();
        $data['id'] = get_the_ID();
        $fg = new FooGallery_Template_Loader();
        $gallery = $fg->find_gallery(array('id' => get_the_ID()));
        $images = array();
        foreach ($gallery->attachments() as $attach) {
            $img = wp_get_attachment_image_src($attach->ID, 'gallery_full');
            $images[] = $img[0];
        }
        $data['images'] = $images;
        $sections[] = $data;
    }
}
wp_reset_query();
$sections = array_chunk($sections, 4, true);
?>