Пример #1
0
 /**
  *
  * @TODO document
  *
  */
 function recent_post()
 {
     $out = '';
     foreach (get_posts('numberposts=1&offset=0') as $key => $p) {
         $out .= sprintf('<li class="list-item fix"><div class="list_item_text"><h5><a class="list_text_link" href="%s"><span class="list-title">%s</span></a></h5><div class="list-excerpt">%s</div></div></li>', get_permalink($p->ID), $p->post_title, custom_trim_excerpt($p->post_content, 12));
     }
     return $out;
 }
Пример #2
0
function grid($data, $args = array())
{
    $defaults = array('data' => 'query', 'per_row' => 3, 'format' => 'img_grid', 'paged' => false, 'has_img' => true, 'image_field' => false, 'img_default' => null, 'img_width' => '100%', 'title' => '', 'title_link' => '', 'class' => 'pagelines-grid', 'row_class' => 'gridrow', 'content_len' => 10, 'callback' => false, 'margin' => true, 'hovercard' => false);
    $a = wp_parse_args($args, $defaults);
    if ($a['data'] == 'users' || $a['data'] == 'array_callback') {
        $posts = $data;
    } else {
        // The Query
        global $wp_query;
        $wp_query = $data;
        $posts = $data->posts;
        if (!is_array($posts)) {
            return;
        }
    }
    // Standard Variables
    $out = '';
    $total = count($posts);
    $count = 1;
    $default_img = isset($a['img_default']) ? sprintf('<img src="%s" alt="%s"/>', $a['img_default'], __('No Image', 'pagelines')) : '';
    $margin_class = $a['margin'] ? '' : 'ppfull';
    if ($a['hovercard']) {
        $out .= pl_js_wrap(sprintf('jQuery(".vignette").hover(function(){jQuery(this).find(".hovercard").fadeIn();}, function(){jQuery(this).find(".hovercard").fadeOut();});'));
    }
    // Grid loop
    foreach ($posts as $pid => $p) {
        // Grid Stuff
        $start = grid_row_start($count, $total, $a['per_row']) ? sprintf('<div class="pprow grid-row fix %s">', $margin_class) : '';
        $end = grid_row_end($count, $total, $a['per_row']) ? '</div>' : '';
        $last_class = grid_row_end($count, $total, $a['per_row']) ? 'pplast' : '';
        // Content
        $content = '';
        if ($a['callback']) {
            $content = call_user_func($a['callback'], $p, $a);
        } else {
            setup_postdata($p);
            $oset = array('post_id' => $p->ID);
            // The Image
            if ($a['image_field'] && ploption($a['image_field'], $oset)) {
                $thumb = sprintf('<img src="%s" alt="thumb" />', ploption($a['image_field'], $oset));
            } elseif (has_post_thumbnail($p->ID)) {
                $thumb = get_the_post_thumbnail($p->ID);
            } else {
                $thumb = $default_img;
            }
            $hovercard = $a['hovercard'] ? sprintf('<div class="hovercard"><span>%s</span></div>', $p->post_title) : '';
            $image = sprintf('<a href="%s" class="img grid-img" style="width: %s"><div class="grid-img-pad"><div class="grid-img-frame"><div class="vignette">%s%s</div></div></div></a>', get_permalink($p->ID), $a['img_width'], $thumb, $hovercard);
            $content .= $image;
            // Text
            if ($a['format'] == 'media') {
                $content .= sprintf('<div class="bd grid-content"><h4><a href="%s">%s</a></h4> <p>%s %s %s</p></div>', get_permalink($p->ID), $p->post_title, custom_trim_excerpt($p->post_content, $a['content_len']), sprintf('<a href="%s" >More &rarr;</a>', get_permalink($p->ID)), pledit($p->ID));
            }
        }
        // Column Box Wrapper
        $out .= sprintf('%s<div class="grid-element pp%s %s %s"><div class="grid-element-pad">%s</div></div>%s', $start, $a['per_row'], $a['format'], $last_class, $content, $end);
        $count++;
    }
    if ($a['paged']) {
        ob_start();
        pagelines_pagination();
        $pages = ob_get_clean();
    } else {
        $pages = '';
    }
    $title_link = $a['title_link'] != '' ? sprintf('<a href="%s" class="button title-link">See All</a>', $a['title_link']) : '';
    $title = $a['title'] != '' ? sprintf('<div class="grid-title"><div class="grid-title-pad fix"><h4 class="gtitle">%s</h4>%s</div></div>', $a['title'], $title_link) : '';
    $wrap = sprintf('<div class="plgrid %s"><div class="plgrid-pad">%s%s%s</div></div>', $a['class'], $title, $out, $pages);
    return $wrap;
}
Пример #3
0
function pl_recent_comments($number = 3)
{
    $comments = get_comments(array('number' => $number, 'status' => 'approve'));
    if ($comments) {
        foreach ((array) $comments as $comment) {
            if ('comment' != get_comment_type($comment)) {
                continue;
            }
            $post = get_post($comment->comment_post_ID);
            $link = get_comment_link($comment->comment_ID);
            $avatar = pl_get_avatar_url(get_avatar($comment));
            $img = $avatar ? sprintf('<div class="img rtimg"><a class="the-media" href="%s" style="background-image: url(%s)"></a></div>', $link, $avatar) : '';
            printf('<li class="media fix">%s<div class="bd"><div class="the-quote pl-contrast"><div class="title" >"%s"</div><div class="excerpt">on <a href="%s">%s</a></div></div></div></li>', $img, stripslashes(substr(wp_filter_nohtml_kses($comment->comment_content), 0, 50)), $link, custom_trim_excerpt($post->post_title, 3));
        }
    }
}
	function section_template() { 
		?>
			<div id="fcolumns_container" class="dcol_container_5 fix">
				
				<?php if (!dynamic_sidebar($this->name) ) : ?>
					<div class="dcol_5 dcol">
						<div class="dcol-pad">
							<?php if(pagelines_option('footer_logo') && VPRO):?>
								<a class="home" href="<?php echo home_url(); ?>" title="<?php _e('Home','pagelines');?>">
									<img src="<?php echo pagelines_option('footer_logo');?>" alt="<?php bloginfo('name');?>" />
								</a>
							<?php else:?>
								<h3 class="site-title">
									<a class="home" href="<?php echo home_url(); ?>" title="<?php _e('Home','pagelines');?>">
										<?php bloginfo('name');?>
									</a>
								</h3>
							<?php endif;?>
						</div>
					</div>
					<div class="dcol_5 dcol">
						<div class="dcol-pad">
							<h3 class="widget-title"><?php _e('Pages','pagelines');?></h3>
								<?php wp_nav_menu( array('menu_class' => 'footer-links list-links', 'theme_location'=>'footer_nav', 'depth' => 1) ); ?>

						</div>
					</div>
					<div class="dcol_5 dcol">
						<div class="dcol-pad">
							<h3 class="widget-title"><?php _e('The Latest','pagelines');?></h3>
								<ul class="latest_posts">
								<?php foreach(get_posts('numberposts=1&offset=0') as $key => $post):
										setup_postdata($post);?>
										<li class="list-item fix">
											<div class="list_item_text">
												<h5><a class="list_text_link" href="<?php echo get_permalink( $post->ID ); ?>"><span class="list-title"><?php echo $post->post_title; ?></span></a></h5>
												<div class="list-excerpt"><?php echo ( !is_404() ) ? custom_trim_excerpt(get_the_excerpt(), 12) : ''; ?></div>
											</div>
										</li>
								<?php endforeach;?></ul>
						</div>
					</div>
					<div class="dcol_5 dcol">
						<div class="dcol-pad">
							<h3 class="widget-title"><?php _e('More','pagelines');?></h3>
							<div class="findent footer-more">
								<?php print_pagelines_option('footer_more');?>
							</div>
						</div>
					</div>
					<div class="dcol_5 dcol">
						<div class="dcol-pad">
							<div class="findent terms">
								<?php print_pagelines_option('footer_terms');?>
							</div>
						</div>
					</div>
				<?php endif; ?>
			</div>	
			<div class="clear"></div>
		<?php
	}
Пример #5
0
    /**
     *
     * @TODO document
     *
     */
    function draw_features($f, $class, $clone_id = null)
    {
        // Setup
        global $post;
        global $pagelines_ID;
        global $pagelines_layout;
        $current_page_post = $post;
        if (empty($f)) {
            echo setup_section_notify($this, __("No Feature posts matched this page's criteria", 'pagelines'));
            return;
        }
        // Options
        $feature_source = ploption('feature_source', $this->oset);
        $timeout = ploption('timeout', $this->oset);
        $playpause = ploption('feature_playpause', $this->oset);
        $feature_nav_type = ploption('feature_nav_type', $this->oset);
        // Refine
        $no_nav = isset($f) && count($f) == 1 ? ' nonav' : '';
        $footer_nav_class = $class . ' ' . $feature_nav_type . $no_nav;
        $cycle_selector = "fclone" . $clone_id;
        ?>
	<div id="feature_slider" class="<?php 
        echo $cycle_selector . '_wrap ' . $class;
        ?>
 fix">
		<div id="feature-area" class="fset_height">
			<div id="cycle" class="<?php 
        echo $cycle_selector;
        ?>
">
			<?php 
        foreach ($f as $post) {
            // Setup For Std WP functions
            setup_postdata($post);
            $oset = array('post_id' => $post->ID);
            $target = apply_filters('pagelines_features_target', '', $post);
            $feature_style = ploption('feature-style', $oset) ? ploption('feature-style', $oset) : 'text-left';
            $feature_style = apply_filters('pagelines-feature-style', $feature_style);
            $flink_text = ploption('feature-link-text', $oset) ? __(ploption('feature-link-text', $oset)) : __('More', 'pagelines');
            if ($feature_source == 'posts' || $feature_source == 'posts_all') {
                $feature_background_image = '';
                if (plmeta('feature-background-image', $oset)) {
                    $feature_background_image = plmeta('feature-background-image', $oset);
                } elseif (has_post_thumbnail($post->ID)) {
                    $feature_background_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
                    $feature_background_image = $feature_background_image[0];
                } else {
                    $feature_background_image = apply_filters('pagelines-feature-cat-default-image', $this->base_url . '/images/feature1.jpg', $post);
                }
                $background_class = 'bg_cover';
            } else {
                $feature_background_image = ploption('feature-background-image', $oset);
                $background_class = 'bg_cover';
            }
            $feature_design = ploption('feature-design', $oset) ? ploption('feature-design', $oset) : '';
            if ($feature_source == 'posts' || $feature_source == 'posts_all') {
                setup_postdata($post);
            }
            if (plmeta('feature-link-url', $oset)) {
                $action = plmeta('feature-link-url', $oset);
            } elseif (ploption('feature-link-url', $oset)) {
                $action = ploption('feature-link-url', $oset);
            } elseif ($feature_source == 'posts' || $feature_source == 'posts_all') {
                $action = get_permalink();
            } else {
                $action = '';
            }
            $fcontent_class = ploption('fcontent-bg', $oset) ? ploption('feature-bg', $oset) : '';
            $media_image = ploption('feature-media-image', $oset);
            $feature_media = ploption('feature-media', $oset);
            $feature_media_full = ploption('feature-media-full', $oset);
            $feature_wrap_markup = $feature_style == 'text-none' && $action ? 'a' : 'div';
            $feature_wrap_link = $feature_style == 'text-none' && $action ? sprintf('href="%s"', $action) : '';
            $more_link = $feature_style != 'text-none' && $action ? sprintf(' <a %s class="plmore" href="%s" >%s</a>', $target, $action, $flink_text) : '';
            $background_css = $feature_background_image ? sprintf('style="background-image: url(\'%s\');"', $feature_background_image) : '';
            printf('<div id="%s" class="fcontainer %s %s fix" >', 'feature_' . $post->ID, $feature_style, $feature_design);
            printf('<%s class="feature-wrap fset_height %s" %s %s >', $feature_wrap_markup, $background_class, $feature_wrap_link, $background_css);
            if ($feature_wrap_markup != 'a') {
                if ($feature_media && $feature_media_full) {
                    echo $feature_media;
                } else {
                    ?>

								<div class="feature-pad fset_height fix">
									<div class="fcontent scale_text fset_height <?php 
                    echo $fcontent_class;
                    ?>
">
										<div class="fcontent-pad fix">
												<?php 
                    pagelines_register_hook('pagelines_feature_text_top', $this->id);
                    // Hook
                    $link = $feature_source == 'posts' || $feature_source == 'posts_all' ? sprintf('<a %s href="%s">%s</a>', $target, $action, $post->post_title) : $post->post_title;
                    $title = sprintf('<div class="fheading"> <h2 class="ftitle">%s</h2> </div>', $link);
                    $content = $feature_source == 'posts' || $feature_source == 'posts_all' ? apply_filters('pagelines_feature_output', custom_trim_excerpt(get_the_excerpt(), '30')) : do_shortcode(get_the_content());
                    printf('%s<div class="ftext"><div class="fexcerpt">%s%s%s</div></div>', $title, $content, $more_link, pledit($post->ID));
                    pagelines_register_hook('pagelines_fcontent_after', $this->id);
                    // Hook
                    ?>
										</div>
									</div>

									<div class="fmedia fset_height" style="">
										<div class="fmedia-pad">
											<?php 
                    pagelines_register_hook('pagelines_feature_media_top', $this->id);
                    // Hook
                    if ($media_image) {
                        printf('<div class="media-frame"><img src="%s" /></div>', $media_image);
                    } elseif ($feature_media) {
                        echo do_shortcode($feature_media);
                    }
                    ?>
										</div>
									</div>
									<?php 
                    pagelines_register_hook('pagelines_feature_after', $this->id);
                    // Hook
                    ?>
									<div class="clear"></div>
								</div>

							<?php 
                }
            }
            printf('</%s>', $feature_wrap_markup);
            echo '</div>';
        }
        $post = $current_page_post;
        ?>
			</div>
		</div>
			<?php 
        pagelines_register_hook('pagelines_feature_nav_before', $this->id);
        // Hook
        $playpause = $timeout != 0 && $playpause ? sprintf('<span class="playpause pause %s"><span>&nbsp;</span></span>', $cycle_selector) : '';
        $nav = sprintf('<div id="featurenav" class="%s subtext fix"></div>', $cycle_selector);
        printf('<div id="feature-footer" class="%s fix"><div class="feature-footer-pad">%s%s<div class="clear"></div></div></div>', $footer_nav_class, $playpause, $nav);
        ?>
	</div>
	<div class="clear"></div>
<?php 
    }
Пример #6
0
    function stories_array_format($args)
    {
        $btn_text = isset($args['btn-text']) ? $args['btn-text'] : false;
        $align_class = isset($args['align']) && $args['align'] == 'right' ? 'rtimg' : '';
        $target = isset($args['target']) && $args['target'] == 'new' ? 'target="_blank"' : '';
        $format = isset($args['format']) && $args['format'] == 'plus-extensions' ? 'plus' : 'standard';
        ob_start();
        $count = 1;
        foreach ($args['data'] as $id => $story) {
            $image = isset($story['img']) ? $story['img'] : false;
            $tag = isset($story['tag']) ? $story['tag'] : false;
            $link = isset($story['link']) ? $story['link'] : false;
            $btn_text = isset($story['btn-text']) ? $story['btn-text'] : $btn_text;
            $tag_class = isset($story['tag-class']) ? $story['tag-class'] : '';
            $alt = $count % 2 == 0 ? 'alt-story' : '';
            $excerpt = isset($story['text']) ? $story['text'] : '';
            $title = isset($story['link']) ? sprintf('<a href="%s">%s</a>', $story['link'], $story['title']) : $story['title'];
            if ($excerpt) {
                $excerpt = !$args['excerpt-trim'] ? $story['text'] : custom_trim_excerpt($story['text'], $args['excerpt-trim']);
            }
            ?>
		<div class="pl-dashboard-story media <?php 
            echo $alt;
            ?>
 dashpane">
			<div class="dashpane-pad fix">
				<?php 
            if ($tag) {
                $button = $this->get_upgrade_button($story['data']);
                printf('<div class="img %s">%s</div>', $align_class, $button);
            } elseif ($btn_text) {
                printf('<div class="img %s"><a class="extend_button" href="%s" %s>%s</a></div>', $align_class, $link, $target, $btn_text);
            } elseif ($image) {
                printf('<div class="img %s img-frame"><img src="%s" /></div>', $align_class, $image);
            }
            ?>
				<div class="bd">
					<h4 class="story-title"><?php 
            echo $title;
            ?>
</h4>
					<p><?php 
            echo $excerpt;
            ?>
</p>
					<?php 
            $this->special_buttons($args, $story);
            ?>

				</div>
			</div>
		</div>

		<?php 
            $count++;
        }
        return ob_get_clean();
    }
Пример #7
0
    function get_author_tag()
    {
        global $post;
        $author_email = get_the_author_meta('email', $post->post_author);
        $author_name = get_the_author();
        $default_avatar = PL_IMAGES . '/avatar_default.gif';
        $author_desc = custom_trim_excerpt(get_the_author_meta('description', $post->post_author), 10);
        ob_start();
        ?>
		<div class="author-tag">
			<div class="tmb"><?php 
        echo get_avatar($author_email, '120');
        ?>
</div>
			<p>[post_author_posts_link]</p>
			<hr/>
		<?php 
        if (has_action('pl_get_author_tag')) {
            do_action('pl_get_author_tag');
        } else {
            ?>
			<p><strong>Published</strong><br/> [post_date][post_edit]</p>
			 
			<p class="hidden-sm hidden-phone">In [post_categories]</p>
			<hr/>
			<p class="tag-comments hidden-sm hidden-phone"><i class="icon icon-comment"></i> [post_comments zero="Add Comment" one="1" more="%"]</p>
		
		<?php 
        }
        echo '</div>';
        return do_shortcode(ob_get_clean());
    }