function get_gallery_popupobjs($post_id, $title_prefix = '')
{
    $attachments = get_post_meta($post_id, '_gattachment', TRUE);
    wpprint($attachments);
    if ($attachments) {
        $gattachments = maybe_unserialize($attachments);
        $imagedata = array();
        foreach ($gattachments as $attid => $img) {
            if (!empty($img)) {
                $attachment = get_gallery_attachment($attid);
                $imagedata[] = array('src' => $img['url'], 'title' => $title_prefix . $attachment->title);
            }
        }
        return json_encode($imagedata);
    }
}
Esempio n. 2
0
?>
 </h2>
  <div class="row">
    <?php 
$post_id = get_the_ID();
$gallery_images = get_post_meta($post_id, '_gattachment', TRUE);
$gattachments = maybe_unserialize($gallery_images);
if (isset($gattachments[0])) {
    unset($gattachments[0]);
}
if (!empty($gattachments)) {
    $cointer = 1;
    foreach ($gattachments as $attachment_id => $img) {
        $attchment = wp_get_attachment_image_src($attachment_id, 'medium');
        $thumbnail = @$attchment[0];
        $att = get_gallery_attachment($attachment_id);
        ?>
        <div class="col-xs-6 col-sm-3 gallery-item">
          <div class="thumbnail">
            <img src="<?php 
        echo $thumbnail;
        ?>
" alt="<?php 
        echo $att->title;
        ?>
" />
            <a class="caption" href="<?php 
        echo @$img['url'];
        ?>
" title="<?php 
        echo !empty($att->caption) ? $att->caption : $att->title;