Exemple #1
1
 function add_img_tag($link)
 {
     if (get_post_gallery(get_the_ID())) {
         return $link;
     } else {
         $simplemasonry_apply = get_post_meta(get_the_ID(), 'simplemasonry_apply');
         if (!empty($simplemasonry_apply)) {
             if ($simplemasonry_apply[0] === 'true') {
                 $links = NULL;
                 if (preg_match_all("/<a href=(.+?)><img(.+?)><\\/a>/mis", $link, $result) !== false) {
                     foreach ($result[0] as $value) {
                         $links .= '<div class="item-contents' . get_the_ID() . '">' . $value . '</div>' . "\n";
                     }
                 }
                 $links = '<div id="container-contents' . get_the_ID() . '" class="centered">' . "\n" . $links . '</div>' . "\n";
                 $this->footer_jscss_s['contents' . get_the_ID()] = $this->add_jscss('contents');
                 return $links;
             } else {
                 return $link;
             }
         } else {
             return $link;
         }
     }
 }
Exemple #2
0
/**
 * Truncate gallery
 *
 * @link
 */
function _s_truncate_gallery($atts)
{
    $atts = shortcode_atts(array('total' => -1), $atts);
    $args = array('p' => get_the_id());
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        $gallery_image_ids_array = array();
        while ($query->have_posts()) {
            $query->the_post();
            if (get_post_gallery()) {
                $gallery = get_post_gallery(get_the_ID(), false);
                $gallery_image_ids = explode(",", $gallery['ids']);
                $c = 0;
                foreach ($gallery_image_ids as $gallery_image_id) {
                    array_push($gallery_image_ids_array, $gallery_image_id);
                    if (++$c == $atts['total']) {
                        break;
                    }
                }
            }
        }
    }
    $query->reset_postdata();
    return implode(',', $gallery_image_ids_array);
}
/**
 * Show featured gallery for gallery post format
 */
function azeria_post_gallery()
{
    $post_id = get_the_ID();
    // first - try to get images from galleries in post
    $post_gallery = get_post_gallery($post_id, false);
    if (!empty($post_gallery['ids'])) {
        $post_gallery = explode(',', $post_gallery['ids']);
    } elseif (!empty($post_gallery['src'])) {
        $post_gallery = $post_gallery['src'];
    } else {
        $post_gallery = false;
    }
    // if can't try to catch images inserted into post
    if (!$post_gallery) {
        $post_gallery = azeria_post_images($post_id, 15);
    }
    // and if not find any images - try to get images attached to post
    if (!$post_gallery || empty($post_gallery)) {
        $attachments = get_children(array('post_parent' => $post_id, 'posts_per_page' => 3, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
        if ($attachments && is_array($attachments)) {
            $post_gallery = array_keys($attachments);
        }
    }
    if (!$post_gallery || empty($post_gallery)) {
        return false;
    }
    $output = azeria_get_gallery_html($post_gallery);
    echo $output;
}
Exemple #4
0
function get_gallery_post()
{
    if (isset($_POST['id']) && !empty($_POST['id'])) {
        $projectsCats = array('cocheras', 'terrazas', 'habitaciones', 'antes-despues');
        $id = $_POST['id'];
        $post = get_post($id);
        $gallery = get_post_gallery($post->ID, false);
        $category = get_the_category($post->ID);
        $cat_elements = array();
        $cat_info = array();
        foreach ($projectsCats as $cat) {
            $catdata = get_category_by_slug($cat);
            $args = array('category_name' => $cat, 'orderby' => 'meta_value_num', 'meta_key' => 'order', 'order' => 'ASC', 'posts_per_page' => 3);
            $projects = new WP_Query($args);
            array_push($cat_info, $catdata);
            array_push($cat_elements, $projects);
        }
        if ($gallery !== false) {
            $gallerydata = array();
            $images = explode(',', $gallery['ids']);
            foreach ($images as $key => $image) {
                $imagedata = wp_prepare_attachment_for_js($image);
                array_push($gallerydata, $imagedata);
            }
            $post_info = array('post' => $post, 'category' => $category, 'categories' => $cat_elements, 'cat_info' => $cat_info, 'gallery' => $gallerydata);
            echo json_encode($post_info);
        }
        die;
    } else {
        echo 'error';
        die;
    }
    die;
}
Exemple #5
0
function blocks_get_gallery($post_id)
{
    $ret = array('tags' => array(), 'images' => array());
    $gallery = get_post_gallery($post_id, false);
    $gallery_ids = $gallery ? explode(',', $gallery['ids']) : array();
    foreach ($gallery_ids as $id) {
        $thumb = wp_get_attachment_image_src($id, 'medium');
        $image = wp_get_attachment_image_src($id, 'large');
        if ($thumb && $image) {
            $image_data = array('tags' => array(), 'tags_string' => '');
            $image_data['thumbnail'] = $thumb;
            $image_data['image'] = $image;
            $image_data['tags'] = wp_get_post_tags($id);
            foreach ($image_data['tags'] as $tag) {
                $ret['tags'][$tag->slug] = $tag->name;
                $image_data['tags_string'] .= ' ' . $tag->slug;
            }
            $data = wp_prepare_attachment_for_js($id);
            $image_data['title'] = $data['title'];
            $image_data['caption'] = $data['caption'];
            $image_data['alt'] = $data['alt'];
            $image_data['description'] = $data['description'];
            $image_data['link'] = get_post_meta($id, "_blocks_link", true);
            $ret['images'][] = $image_data;
        }
    }
    asort($ret['tags']);
    return $ret;
}
function get_home_gallery()
{
    $galls = get_post_gallery(4, false);
    if (!empty($galls['ids'])) {
        $ids = explode(',', $galls['ids']);
        foreach ($ids as $id) {
            //$gall[] = wp_get_attachment_url($id);
            echo '<div class="galery-item" style="background: url(\'' . wp_get_attachment_url($id) . '\') center center no-repeat;"></div>';
        }
    }
}
Exemple #7
0
    function kreativa_related_media($w, $h)
    {
        ?>
        <div class="ImageWrapper">         
           <?php 
        if (get_post_gallery()) {
            $gallery = get_post_gallery(get_the_ID(), false);
            ?>
 
                <div class="slider">                                           
                  <div class="fullwidthbanner-container">
                    <div class="fullwidthbanner">
                      <ul>                                  
                        <?php 
            foreach ($gallery['src'] as $src) {
                $img_url = wp_get_attachment_image_src($src);
                $n_img = aq_resize($src, $width = $w, $height = $h, $crop = true, $single = true, $upscale = true);
                ?>
                          <li class="first-slide" data-transition="fade" data-slotamount="10" data-masterspeed="300">
                            <img class="img-responsive" src="<?php 
                echo esc_url($n_img);
                ?>
" alt="" data-fullwidthcentering="on" alt="slide">
                          </li>                              
                        <?php 
            }
            ?>
                      </ul> 
                    </div>                             
                  </div>
                </div>
            <?php 
        }
        ?>
            <?php 
        if (has_post_thumbnail() && !get_post_gallery()) {
            $thumbnail = get_post_thumbnail_id();
            $img_url = wp_get_attachment_image_src($thumbnail, 'full');
            $n_img = aq_resize($img_url[0], $width = $w, $height = $h, $crop = true, $single = true, $upscale = true);
            //get img URL
            ?>
<div class="portfolio-media"> <img src="<?php 
            echo esc_url($n_img);
            ?>
" class="img-responsive"/></div> 
            <?php 
        }
        ?>
                      
        </div>
        <?php 
    }
 function add_anchor_tag($link)
 {
     $device = $this->agent_check();
     $boxersandswipers_apply = get_option('boxersandswipers_apply');
     if (!is_attachment()) {
         $is_singular_boxersandswipers_apply = $boxersandswipers_apply[get_post_type(get_the_ID())][$device];
     }
     $is_home_boxersandswipers_apply = $boxersandswipers_apply['home'][$device];
     $is_archive_boxersandswipers_apply = $boxersandswipers_apply['archive'][$device];
     $is_category_boxersandswipers_apply = $boxersandswipers_apply['category'][$device];
     $is_gallery_boxersandswipers_apply = $boxersandswipers_apply['gallery'][$device];
     settype($is_singular_boxersandswipers_apply, "boolean");
     settype($is_home_boxersandswipers_apply, "boolean");
     settype($is_archive_boxersandswipers_apply, "boolean");
     settype($is_category_boxersandswipers_apply, "boolean");
     settype($is_gallery_boxersandswipers_apply, "boolean");
     $boxersandswipers_exclude = get_post_meta(get_the_ID(), 'boxersandswipers_exclude');
     $simplemasonry_apply = get_post_meta(get_the_ID(), 'simplemasonry_apply');
     $simplenivoslider_apply = get_post_meta(get_the_ID(), 'simplenivoslider_apply');
     if (!empty($boxersandswipers_exclude) && $boxersandswipers_exclude[0]) {
         // Through
     } else {
         if (class_exists('SimpleMasonry') && get_post_gallery(get_the_ID()) && !empty($simplemasonry_apply) && $simplemasonry_apply[0] === 'true') {
             // for Simple Masonry Gallery http://wordpress.org/plugins/simple-masonry-gallery/
             // for Gallery
             if ($is_gallery_boxersandswipers_apply) {
                 add_filter('post_gallery', array(&$this, 'gallery_filter'));
             }
             $link = $this->add_anchor_tag_content($link);
         } else {
             if (class_exists('SimpleNivoSlider') && !empty($simplenivoslider_apply) && $simplenivoslider_apply[0] === 'true') {
                 // for Simple Nivo Slider http://wordpress.org/plugins/simple-nivoslider/
                 // Through
             } else {
                 if (!is_attachment()) {
                     // for Gallery
                     if ($is_gallery_boxersandswipers_apply) {
                         add_shortcode('gallery', array(&$this, 'file_gallery_shortcode'));
                         add_filter('post_gallery', array(&$this, 'gallery_filter'));
                     }
                     // for Insert Attachement
                     if (is_singular() && $is_singular_boxersandswipers_apply || is_home() && $is_home_boxersandswipers_apply || is_archive() && $is_archive_boxersandswipers_apply || is_category() && $is_category_boxersandswipers_apply) {
                         $link = $this->add_anchor_tag_content($link);
                     }
                 }
             }
         }
     }
     return $link;
 }
Exemple #9
0
function optimizer_gallery_thumb()
{
    global $post;
    // Make sure the post has a gallery in it
    if (has_shortcode($post->post_content, 'gallery')) {
        $gallery = get_post_gallery(get_the_ID(), false);
        $ids = explode(",", $gallery['ids']);
        foreach ($ids as $id) {
            $imgurl = wp_get_attachment_image_src($id, array(400, 270));
        }
        $first_thumb = $imgurl[0];
        return $first_thumb;
    }
}
function efs_get_slider_postID($postID, $postTitle)
{
    $slider = efs_script($postID);
    $slider .= '<div class="slidertitle">' . $postTitle . '</div>';
    $slider .= '<div id="flexslider-slider' . $postID . '" class="flexslider">
      		<ul class="slides">';
    $carousel = '<div id="flexslider-carousel' . $postID . '" class="flexslider">
		<ul class="slides">';
    $gallery = get_post_gallery($postID, false);
    foreach ($gallery['src'] as $imgsrc) {
        $slider .= '<li><img src="' . $imgsrc . '"/></li>';
        $carousel .= '<li><img src="' . $imgsrc . '"/></li>';
    }
    $slider .= '</ul>
	</div>';
    $carousel .= '</ul>
	</div>';
    $slider .= $carousel;
    return $slider;
}
function get_post_thumbnail($pid, $w, $h = 0)
{
    $tid = get_post_thumbnail_id($pid);
    $size = 'full';
    $src = wp_get_attachment_image_src($tid, $size);
    $src = $src[0];
    if (!isset($src)) {
        $gal = get_post_gallery($pid);
        $src = $gal[0]->guid;
    }
    if (isset($w) && $h == 0) {
        $base = basename($src);
        $src = '/wp-content/image.php/' . $base . '?image=' . $src . '&amp;width=' . $w;
    } else {
        if (isset($w) && isset($h)) {
            $base = basename($src);
            $src = '/wp-content/image.php/' . $base . '?image=' . $src . '&amp;width=' . $w . '&amp;height=' . $h . '&amp;cropratio=' . $w . ':' . $h;
        }
    }
    return $src;
}
    ?>
</span>    
    </div>
<?php 
}
?>
<article id="post-<?php 
the_ID();
?>
" <?php 
post_class('postEntry');
?>
>
    <?php 
$gallery_image_size = array('width' => 750, 'height' => 350);
$gallery = get_post_gallery($post, false);
$ids = explode(",", $gallery['ids']);
//print_r($ids);
if ($gallery) {
    ?>
        <div class="gallerySlider owl-carousel">
            <?php 
    foreach ($ids as $id) {
        $image_url = wp_get_attachment_url($id);
        echo '<div class="slideItem"><img src="' . bfi_thumb($image_url, $gallery_image_size) . '"></div>';
    }
    ?>
        </div>
        <?php 
}
?>
<article id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>

	<header class="entry-header">
		<?php 
the_title('<h1 class="entry-title">', '</h1>');
?>
	</header>

	<?php 
if (get_post_gallery()) {
    get_template_part('content/content', 'portfolio-gallery');
}
?>

	<div class="entry-content">
		<?php 
$content = get_the_content();
/**
 * Get the gallery data from the post.
 */
$gallery_shortcode = argent_get_gallery();
/**
 * Grab the first shortcode in post content, strip it out, and
 * display the post content without the first gallery.
 */
				<?
			} else if(in_category('remolques')) {
				?>
					<h1>Remolque con Sanitarios <?php the_title(); ?></h1>
				<?
			}
		?>
		<div class="single-header block">
			<!-- 
			<div class="portada-header">
				<?php the_post_thumbnail('portada'); ?>
			</div>
			el thumb -->
			<!-- comienza gallery -->
			<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
				<?php echo get_post_gallery(); ?>
			<?php endwhile; endif; wp_reset_postdata(); ?>
			<!-- fin gallery -->
		</div>
		<!-- columnas -->
		<div class="columnas">
			<div class="contentleft bg-fff pin">
				<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
				<?php
				    $content = strip_shortcode_gallery( get_the_content() );                                        
				    $content = str_replace( ']]>', ']]&gt;', apply_filters( 'the_content', $content ) );
					echo $content;
				?>
				<?php endwhile; endif; ?>
			</div>
			<?php if(in_category('remolques')) {
Exemple #15
0
    $check_gallery = 0;
    $check_audio = 0;
    $check_link = 0;
    $var_quote = 0;
    ?>
 
        <!-- Gallery Post Format -->   
        <?php 
    if (has_post_format('gallery')) {
        $check_gallery = 1;
        ?>
            
            <div class="owl-img">         
               <?php 
        if (get_post_gallery()) {
            $gallery = get_post_gallery(get_the_ID(), false);
            ?>
             
                        <?php 
            foreach ($gallery['src'] as $src) {
                $img_url = wp_get_attachment_image_src($src, 'full');
                $n_img = aq_resize($src, $width = 750, $height = 316, $crop = true, $single = true, $upscale = true);
                ?>
                            <div> <a href="javascript:void(0)"><img class="img-responsive" src="<?php 
                echo esc_url($n_img);
                ?>
" alt=""></a> </div>
                                                                            
                        <?php 
            }
            ?>
/**
 * Get featured gallery.
 * If has post thumbnail - will get post thumbnail, else - get first image from content.
 *
 * @since  4.0.0
 * @return string
 */
function cherry_get_the_post_gallery()
{
    /**
     * Filter post format gallery output to rewrite gallery from child theme or plugins
     * @since  4.0.0
     */
    $result = apply_filters('cherry_pre_get_post_gallery', false);
    if (false !== $result) {
        return $result;
    }
    $post_id = get_the_ID();
    // first - try to get images from galleries in post
    $shortcode_replaced = cherry_get_option('blog-gallery-shortcode', 'true');
    $is_html = 'true' == $shortcode_replaced ? true : false;
    $post_gallery = get_post_gallery($post_id, $is_html);
    // if stanadrd gallery shortcode replaced with cherry - return HTML
    if (is_string($post_gallery) && !empty($post_gallery)) {
        return $post_gallery;
    }
    if (!empty($post_gallery['ids'])) {
        $post_gallery = explode(',', $post_gallery['ids']);
    } elseif (!empty($post_gallery['src'])) {
        $post_gallery = $post_gallery['src'];
    } else {
        $post_gallery = false;
    }
    // if can't try to catch images inserted into post
    if (!$post_gallery) {
        $post_gallery = cherry_get_post_images($post_id, 15);
    }
    // and if not find any images - try to get images attached to post
    if (!$post_gallery || empty($post_gallery)) {
        $attachments = get_children(array('post_parent' => $post_id, 'posts_per_page' => 3, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
        if ($attachments && is_array($attachments)) {
            $post_gallery = array_keys($attachments);
        }
    }
    if (!$post_gallery || empty($post_gallery)) {
        return false;
    }
    $output = cherry_get_gallery_html($post_gallery);
    /**
     * Filter a post gallery.
     *
     * @since 4.0.0
     */
    $output = apply_filters('cherry_get_the_post_gallery', $output);
    return $output;
}
Exemple #17
0
    public function widget($args, $instance)
    {
        /** This filter is documented in wp-includes/default-widgets.php */
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        echo '<aside class="widget widget_gallery">';
        //  echo $args['before_widget'];
        if ($title) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        // Use current theme search form if it exists
        ?>
    <ul>
      <?php 
        if ($gallery = get_post_gallery(get_the_ID(), false)) {
            ?>
          <?php 
            foreach ($gallery['src'] as $src) {
                ?>
          <li><a title="Images Gallery" href="#"><img src="<?php 
                echo $src;
                ?>
" alt="gallery" class="gallery-post" /></a></li>
          <?php 
            }
            ?>
      <?php 
        }
        ?>

    </ul>
    <?php 
        // echo $args['after_widget'];
        echo '</aside>';
    }
Exemple #18
0
<?php

/*
Template Name: Web
*/
get_header();
?>
<div class="page">
	<?php 
get_template_part('nav');
?>
	<section>
		<?php 
get_template_part('loader');
?>
		<?php 
echo get_post_gallery($post->ID);
?>
	</section>
</div>
<?php 
get_footer();
    function _lb41f3b28111_content($_l, $_args)
    {
        extract($_args);
        ?>

<?php 
        if (trim($post->content) != "") {
            ?>
<style>
   
    
</style>
<section class="section content-section">

<div id="container" class="subpage wrapper onecolumn">

	<div id="content" class="entry-content clearfix" role="main">
		<div class="content-wrapper clearfix">

			<header class="entry-title clearfix">
                            <h1 class="text-align-center"><?php 
            echo NTemplateHelpers::escapeHtml($post->title, ENT_NOQUOTES);
            ?>
</h1> 
                
                                                        <?php 
            /* The loop */
            while (have_posts()) {
                the_post();
                if (get_post_gallery()) {
                    $gallery = get_post_gallery(get_the_ID(), false);
                    $idsexp = explode(",", $gallery['ids']);
                    /* Loop through all the image and output them one by one */
                    foreach ($gallery['src'] as $key => $src) {
                        $attachment_meta = wp_get_attachment($idsexp[$key]);
                        $var[$key]['descricao'] = $attachment_meta["alt"];
                        $var[$key]['src'] = $src;
                        $var[$key]['grupo'] = $attachment_meta["caption"];
                    }
                    $arr = array();
                    foreach ($var as $v2) {
                        $arr[] = $v2['grupo'];
                    }
                    $arr2 = array_unique($arr);
                    foreach ($arr2 as $grupo) {
                        ?>
 <div class="clientes-1">
                                            <h2 class="clientes-2"><?php 
                        echo $grupo;
                        ?>
</h2>
                                        </div><?php 
                        $contador = 0;
                        foreach ($var as $key2 => $v) {
                            if ($v['grupo'] == $grupo) {
                                $contador++;
                                if ($contador % 3 == 0) {
                                    $last = 1;
                                } else {
                                    $last = 0;
                                }
                                ?>
                    <div class="clientes-3 <?php 
                                if ($last == 0) {
                                    ?>
 last-bloco <?php 
                                }
                                ?>
">
                        <div class="clientes-4">
                            <img src="<?php 
                                echo $v['src'];
                                ?>
" class="my-custom-class" alt="Gallery image" width="240" height="240" />
                        </div>
                        <div class="clientes-5">
                            <center><b><?php 
                                echo $v['descricao'];
                                ?>
</b></center>
                        </div>
                    </div>
                    
                    <?php 
                            }
                        }
                    }
                }
            }
            ?>

			</header>


        </div> <!-- /.content-wrapper -->

	</div> <!-- /#content -->

</div> <!-- /#container -->

</section>

<?php 
        }
        ?>

<?php 
    }
if ('wide' == $preview_mode) {
    $post_classes[] = 'media-wide';
}
?>

<?php 
do_action('presscore_before_post');
?>

<article <?php 
post_class($post_classes);
?>
>
<div class="blog-media wf-td">
	<?php 
$gallery = get_post_gallery($post->ID, false);
if (!empty($gallery['ids'])) {
    $media_items = array_map('trim', explode(',', $gallery['ids']));
    // if we have post thumbnail and it's not hidden
    if (has_post_thumbnail() && !get_post_meta($post->ID, '_dt_post_options_hide_thumbnail', true)) {
        array_unshift($media_items, get_post_thumbnail_id());
    }
    $attachments_data = presscore_get_attachment_post_data($media_items);
    $preview_style = get_post_meta($post->ID, '_dt_post_options_preview_style_gallery', true);
    $style = ' style="width: 100%;"';
    $class = array('alignnone');
    if (!in_array($layout, array('masonry', 'grid')) && 'normal' == $preview_mode) {
        $class = array('alignleft');
        $style = ' style="width: 270px;"';
    }
    switch ($preview_style) {
Exemple #21
0
    public function widget($args, $instance)
    {
        global $post;
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance);
        $page_id = isset($instance['page_id']) ? esc_attr($instance['page_id']) : '';
        // WP_Query arguments
        $args = array('page_id' => $page_id, 'post_status' => 'publish', 'pagination' => false);
        // The Query
        $swp_about_page = new WP_Query($args);
        $swp_about_page_gallery = get_post_gallery($page_id, false);
        $swp_about_page_gallery_ids = explode(",", $swp_about_page_gallery['ids']);
        ?>
		<section class="section-about wow fadeIn" data-wow-duration="0.5s" data-wow-delay="0.4s" itemscope itemtype="https://schema.org/BlogPosting" id="<?php 
        echo esc_attr($this->id);
        ?>
">
			<div class="row">
				<div class="columns small-12 large-12">
					<?php 
        while ($swp_about_page->have_posts()) {
            $swp_about_page->the_post();
        }
        ?>
					<header class="section-head" itemprop="name">
						<h5><?php 
        echo esc_html($title);
        ?>
</h5>

						<h2><?php 
        the_title();
        ?>
</h2>
					</header><!-- /.section-head -->

					<div class="section-body">
						<p>
							<?php 
        the_content('', FALSE, '');
        ?>
						</p>

						<a href="<?php 
        the_permalink();
        ?>
" class="btn-default"><?php 
        _e('Read More', 'charity-life-wpl');
        ?>
</a>
					</div><!-- /.section-body -->
				</div><!-- /.columns small-12 large-12 -->
			</div><!-- /.row -->
		</section><!-- /.section-about <?php 
        echo esc_attr($this->id);
        ?>
 -->
		<?php 
        wp_reset_postdata();
        ?>
		<?php 
    }
 */
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>

  <div class="container hh-single-top">

    <?php 
        if (has_post_format('gallery')) {
            ?>

      <!-- Slider -->
      <div class="flexslider">
        <?php 
            $gallery = get_post_gallery();
            echo $gallery;
            ?>
      </div>

    <?php 
        } elseif (has_post_format('image')) {
            ?>

      <!-- Single Image -->
      <?php 
            if (has_post_thumbnail()) {
                ?>

      <div class="container">
        <div class="row">
Exemple #23
0
        ?>
				<article id="post-<?php 
        the_ID();
        ?>
" <?php 
        post_class();
        ?>
>
				<?php 
        if (is_front_page()) {
            ?>
					
				<?php 
        } else {
            get_template_part('testimonials', 'featured');
            $gal = get_post_gallery(get_the_ID());
            if ($post_info->fimage && !$gal) {
                echo '<div class="fimage">';
                echo '<img src="' . get_resized_image($post_info->fimage, 610, 300) . '" />';
                if ($post_info->fcaption) {
                    echo '<p class="fcaption caption">' . $post_info->fcaption . '</p>';
                }
                echo '</div>';
            }
            if ($gal) {
                echo '<section class="cycler">';
                foreach ($gal as $img) {
                    //print_r($img);
                    echo '<img class="cycle-image" src="' . get_resized_image($img->guid, 610, 300) . '" alt="' . fullescape(addslashes($img->post_excerpt)) . '">';
                }
                echo '</section>';
 /**
  * Get galeery images list or try to get gallery HTML
  *
  * @param  bool  $is_html is HTML returns or not.
  * @param  array $args    argumnets array.
  * @return mixed
  */
 public function get_gallery_images($is_html, $args = array())
 {
     $post_id = get_the_ID();
     $post_gallery = get_post_gallery($post_id, $is_html);
     // If stanadrd gallery shortcode replaced with cherry - return HTML.
     if (is_string($post_gallery) && !empty($post_gallery)) {
         return $post_gallery;
     }
     if (!empty($post_gallery['ids'])) {
         $post_gallery = explode(',', $post_gallery['ids']);
     } elseif (!empty($post_gallery['src'])) {
         $post_gallery = $post_gallery['src'];
     } else {
         $post_gallery = false;
     }
     // If can't try to catch images inserted into post.
     if (!$post_gallery) {
         $post_gallery = $this->get_post_images($post_id, 15);
     }
     // And if not find any images - try to get images attached to post.
     if (!$post_gallery || empty($post_gallery)) {
         $attachments = get_children(array('post_parent' => $post_id, 'posts_per_page' => 3, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
         if ($attachments && is_array($attachments)) {
             $post_gallery = array_keys($attachments);
         }
     }
     return $post_gallery;
 }
/**
 * Check a post's content for galleries and return the image srcs for the first found gallery
 *
 * @since 3.6.0
 *
 * @param int $post_id Optional. Post ID.
 * @return array A list of a gallery's image srcs in order
 */
function get_post_gallery_images($post_id = 0)
{
    $gallery = get_post_gallery($post_id, false);
    if (empty($gallery['src'])) {
        return array();
    }
    return $gallery['src'];
}
Exemple #26
0
/**
 * Checks a post's content for galleries and return the image srcs for the first found gallery
 *
 * @since 3.6.0
 *
 * @see get_post_gallery()
 *
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
 * @return array A list of a gallery's image srcs in order.
 */
function get_post_gallery_images($post = 0)
{
    $gallery = get_post_gallery($post, false);
    return empty($gallery['src']) ? array() : $gallery['src'];
}
 function wpo_gallery($size = 'full')
 {
     $galleries = get_post_gallery(get_the_ID(), false);
     if (!isset($galleries['ids'])) {
         return array();
     }
     $img_ids = explode(",", $galleries['ids']);
     $output = array();
     foreach ($img_ids as $key => $id) {
         $img_src = wp_get_attachment_image_src($id, $size);
         $output[] = $img_src[0];
     }
     return $output;
 }
Exemple #28
0
 function et_gallery_images()
 {
     printf(do_shortcode('%1$s'), get_post_gallery());
 }
	<?php 
if (is_search()) {
    // Only display Excerpts for Search
    ?>
	<div class="entry-summary">
		<?php 
    the_excerpt();
    ?>
	</div><!-- .entry-summary -->
	<?php 
} else {
    ?>
	<div class="entry-content" style="margin-top: -25px;">
<?php 
    //the_content();
    echo get_post_gallery();
    ?>
		<?php 
    wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'makewp005'), 'after' => '</div>'));
    ?>
	</div><!-- .entry-content -->
	<?php 
}
?>
	<footer class="entry-meta" style="text-align: right;">
			<?php 
if (get_post_format() != '') {
    ?>
<span class="genericon genericon-<?php 
    echo get_post_format();
    ?>
Exemple #30
0
$add_class = has_post_thumbnail() ? 'with-featured-image' : 'without-featured-image';
?>

	<article <?php 
post_class($add_class . ' post');
?>
>
		<div class="post-content">
			<?php 
/**
 * If we have video, display that in place of the featured image
 */
if (get_post_meta($post->ID, 'array-video', true)) {
    echo get_post_meta($post->ID, 'array-video', true);
} else {
    if (has_post_format('gallery') && get_post_gallery()) {
        ?>

				<?php 
        /**
         * Get the image carousel template
         * @see content-carousel.php
         */
        get_template_part('partials/content-carousel');
        ?>

			<?php 
    } else {
        if (has_post_thumbnail()) {
            ?>
				<?php