Ejemplo n.º 1
0
$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";
        $image = get_field($fieldId);
Ejemplo n.º 2
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);
?>


<?php