Example #1
0
function wpv_get_portfolio_options($group, $rel_group)
{
    global $post;
    $res = array();
    $res['image'] = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_id()), 'full', true);
    $res['type'] = wpv_default(get_post_meta(get_the_id(), 'portfolio_type', true), 'image');
    $res['width'] = '';
    $res['height'] = '';
    $res['iframe'] = '';
    $res['link_target'] = '_self';
    $res['rel'] = $group == 'true' ? ' rel="' . $rel_group . '"' : '';
    // calculate some options depending on the portfolio item's type
    if ($res['type'] == 'image' || $res['type'] == 'html') {
        $res['href'] = $res['image'][0];
        $res['lightbox'] = ' vamtam-lightbox';
    } elseif ($res['type'] == 'video') {
        $res['href'] = get_post_meta(get_the_id(), 'wpv-portfolio-format-video', true);
        if (empty($res['href'])) {
            $res['href'] = $res['image'][0];
        }
    } elseif ($res['type'] == 'link') {
        $res['href'] = get_post_meta(get_the_ID(), 'wpv-portfolio-format-link', true);
        $res['link_target'] = get_post_meta(get_the_ID(), '_link_target', true);
        $res['link_target'] = $res['link_target'] ? $res['link_target'] : '_self';
        $res['lightbox'] = ' no-lightbox';
        $res['rel'] = '';
    } elseif ($res['type'] == 'gallery') {
        list($res['gallery'], ) = WpvPostFormats::get_first_gallery(get_the_content(), null, WpvPostFormats::get_thumb_name(array('p' => $post)));
    } elseif ($res['type'] == 'document') {
        if (is_single()) {
            $res['href'] = $res['image'][0];
            $res['lightbox'] = ' vamtam-lightbox';
        } else {
            $res['href'] = get_permalink();
            $res['lightbox'] = ' no-lightbox';
        }
        $res['rel'] = '';
    }
    return $res;
}
Example #2
0
 * The common code for the single and looped post template
 *
 * @package wpv
 */
global $post;
extract(WpvPostFormats::post_layout_info());
$format = get_post_format();
$format = empty($format) ? 'standard' : $format;
if (defined('WPV_ARCHIVE_TEMPLATE')) {
    $show_content = false;
}
$post_data = array_merge(array('p' => $post, 'format' => $format, 'content' => is_single() ? get_the_content() : ($show_content && !$news ? get_the_content(__('Read more', 'honeymoon'), false) : get_the_excerpt())), WpvPostFormats::post_layout_info());
if (has_post_format('quote') && !is_single() && ($news || !$show_content)) {
    $post_data['content'] = '';
}
$post_data = WpvPostFormats::process($post_data);
$has_media = isset($post_data['media']) ? 'has-image' : 'no-image';
?>
<div class="post-article <?php 
echo $has_media;
?>
-wrapper <?php 
echo is_single() ? 'single' : '';
?>
">
	<div class="<?php 
echo $format;
?>
-post-format clearfix <?php 
echo isset($post_data['act_as_image']) ? 'as-image' : 'as-normal';
?>
Example #3
0
    /**
     * Displays the icon for a post format $format
     * @param  string $format post format slug
     * @return string         icon html
     */
    public static function post_format_icon($format)
    {
        ?>
		<a class="single-post-format" href="<?php 
        echo esc_attr(add_query_arg('format_filter', $format, home_url()));
        ?>
" title="<?php 
        echo esc_attr(get_post_format_string($format));
        ?>
">
			<?php 
        echo do_shortcode('[icon name="' . WpvPostFormats::get_post_format_icon($format) . '"]');
        ?>
		</a>
		<?php 
    }
        global $wpv_has_header_sidebars;
        if ($wpv_has_header_sidebars) {
            WpvTemplates::header_sidebars();
        }
        $column_width = wpv_get_central_column_width();
        $size = $column_width;
        ?>

					<div class="clearfix">
					<?php 
        if ($type != 'document') {
            ?>
						<div class="portfolio_image_wrapper fullwidth-folio">
							<?php 
            if ($type == 'gallery') {
                list($gallery, ) = WpvPostFormats::get_first_gallery(get_the_content(), null, 'single-portfolio');
                echo do_shortcode($gallery);
            } elseif ($type == 'video') {
                global $wp_embed;
                echo do_shortcode($wp_embed->run_shortcode('[embed width="' . $size . '"]' . $href . '[/embed]'));
            } elseif ($type == 'html') {
                echo do_shortcode(get_post_meta(get_the_ID(), 'portfolio-top-html', true));
            } else {
                the_post_thumbnail('single-portfolio');
            }
            ?>
						</div>
					<?php 
        }
        ?>
					</div>
<?php

/**
 * Single portfolio content template
 * @package wpv
 */
$is_ajax = isset($_SERVER['HTTP_X_VAMTAM']) && $_SERVER['HTTP_X_VAMTAM'] == 'ajax-portfolio';
$client = get_post_meta(get_the_id(), 'portfolio-client', true);
$logo = get_post_meta(get_the_id(), 'portfolio-logo', true);
$client = preg_replace('@</\\s*([^>]+)\\s*>@', '</$1>', $client);
$content = get_the_content();
$portfolio_options = wpv_get_portfolio_options('true', '');
if ($portfolio_options['type'] == 'gallery') {
    list(, $content) = WpvPostFormats::get_first_gallery($content);
}
$content = apply_filters('the_content', $content);
$has_right_column = !empty($logo) || !empty($client);
$left_column_width = $has_right_column ? 'grid-4-5' : 'grid-1-1 last';
?>

<div class="row portfolio-content">
	<div class="<?php 
echo $left_column_width;
?>
">
		<?php 
if ($is_ajax) {
    ?>
			<?php 
    WpvTemplates::breadcrumbs();
    WpvTemplates::page_header(false, get_the_title());
<ul class="clearfix">
	<li class="post-format-pad"><a title="<?php 
esc_attr_e('Standard', 'church-event');
?>
" href="<?php 
echo esc_attr(add_query_arg('format_filter', 'standard', home_url()));
?>
" class="standard"><?php 
echo do_shortcode('[icon name="' . WpvPostFormats::get_post_format_icon('standard') . '"]');
?>
</a></li>
	<?php 
$tooltip = empty($instance['tooltip']) ? __('View all %format posts', 'church-event') : esc_attr($instance['tooltip']);
foreach (get_post_format_strings() as $slug => $string) {
    if (get_post_format_link($slug)) {
        $post_format = get_term_by('slug', 'post-format-' . $slug, 'post_format');
        if ($post_format->count > 0) {
            echo '<li class="post-format-pad"><a title="' . esc_attr(str_replace('%format', $string, $tooltip)) . '" href="' . esc_attr(add_query_arg('format_filter', $slug, home_url())) . '" class="' . $slug . '">' . do_shortcode('[icon name="' . WpvPostFormats::get_post_format_icon($slug) . '"]') . '</a></li>';
        }
    }
}
?>
</ul>
 /**
  * returns a list of gallery ids
  *
  * @param $post WP_Post  regular WP post object
  * @return array
  */
 private static function get_gallery_images($post)
 {
     list($gallery, ) = WpvPostFormats::get_first_gallery($post->post_content, null, 'full');
     $pattern = get_shortcode_regex();
     preg_match("/{$pattern}/s", $gallery, $matches);
     $attr = shortcode_atts(array('ids' => ''), shortcode_parse_atts($matches[3]));
     return empty($attr['ids']) ? array() : explode(',', $attr['ids']);
 }