예제 #1
0
 function sc_blog($attr, $content = null)
 {
     extract(shortcode_atts(array('count' => 2, 'category' => '', 'category_multi' => '', 'style' => 'classic', 'columns' => 3, 'greyscale' => '', 'more' => '', 'filters' => '', 'pagination' => '', 'load_more' => ''), $attr));
     $translate['filter'] = mfn_opts_get('translate') ? mfn_opts_get('translate-filter', 'Filter by') : __('Filter by', 'betheme');
     $translate['tags'] = mfn_opts_get('translate') ? mfn_opts_get('translate-tags', 'Tags') : __('Tags', 'betheme');
     $translate['authors'] = mfn_opts_get('translate') ? mfn_opts_get('translate-authors', 'Authors') : __('Authors', 'betheme');
     $translate['all'] = mfn_opts_get('translate') ? mfn_opts_get('translate-item-all', 'All') : __('All', 'betheme');
     $translate['categories'] = mfn_opts_get('translate') ? mfn_opts_get('translate-categories', 'Categories') : __('Categories', 'betheme');
     $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1);
     $args = array('posts_per_page' => intval($count), 'paged' => $paged, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
     // categories
     if ($category_multi) {
         $args['category_name'] = trim($category_multi);
     } elseif ($category) {
         $args['category_name'] = $category;
     }
     // classes
     $classes = $style;
     if ($greyscale) {
         $classes .= ' greyscale';
     }
     if (!$more) {
         $classes .= ' hide-more';
     }
     if (in_array($style, array('masonry', 'masonry tiles'))) {
         $classes .= ' isotope';
     }
     $query_blog = new WP_Query($args);
     $output = '<div class="column_filters">';
     // Echo | Filters
     if ($filters && in_array($style, array('masonry', 'masonry tiles')) && !$category && !$category_multi) {
         $filters_class = '';
         if ($filters != 1) {
             $filters_class .= ' only ' . $filters;
         }
         $output .= '<div id="Filters" class="isotope-filters ' . $filters_class . '" data-parent="column_filters">';
         $output .= '<ul class="filters_buttons">';
         $output .= '<li class="label">' . $translate['filter'] . '</li>';
         $output .= '<li class="categories"><a class="open" href="#"><i class="icon-docs"></i>' . $translate['categories'] . '<i class="icon-down-dir"></i></a></li>';
         $output .= '<li class="tags"><a class="open" href="#"><i class="icon-tag"></i>' . $translate['tags'] . '<i class="icon-down-dir"></i></a></li>';
         $output .= '<li class="authors"><a class="open" href="#"><i class="icon-user"></i>' . $translate['authors'] . '<i class="icon-down-dir"></i></a></li>';
         $output .= '</ul>';
         $output .= '<div class="filters_wrapper">';
         // categories
         $output .= '<ul class="categories">';
         $output .= '<li class="reset current-cat"><a class="all" data-rel="*" href="#">' . $translate['all'] . '</a></li>';
         if ($categories = get_categories()) {
             foreach ($categories as $category) {
                 $output .= '<li class="' . $category->slug . '"><a data-rel=".category-' . $category->slug . '" href="' . get_term_link($category) . '">' . $category->name . '</a></li>';
             }
         }
         $output .= '<li class="close"><a href="#"><i class="icon-cancel"></i></a></li>';
         $output .= '</ul>';
         // tags
         $output .= '<ul class="tags">';
         $output .= '<li class="reset current-cat"><a class="all" data-rel="*" href="#">' . $translate['all'] . '</a></li>';
         if ($tags = get_tags()) {
             foreach ($tags as $tag) {
                 $output .= '<li class="' . $tag->slug . '"><a data-rel=".tag-' . $tag->slug . '" href="' . get_tag_link($tag) . '">' . $tag->name . '</a></li>';
             }
         }
         $output .= '<li class="close"><a href="#"><i class="icon-cancel"></i></a></li>';
         $output .= '</ul>';
         // authors
         $output .= '<ul class="authors">';
         $output .= '<li class="reset current-cat"><a class="all" data-rel="*" href="#">' . $translate['all'] . '</a></li>';
         $authors = mfn_get_authors();
         if (is_array($authors)) {
             foreach ($authors as $auth) {
                 $output .= '<li class="' . mfn_slug($auth->data->user_login) . '"><a data-rel=".author-' . mfn_slug($auth->data->user_login) . '" href="' . get_author_posts_url($auth->ID) . '">' . $auth->data->display_name . '</a></li>';
             }
         }
         $output .= '<li class="close"><a href="#"><i class="icon-cancel"></i></a></li>';
         $output .= '</ul>';
         $output .= '</div>';
         $output .= '</div>' . "\n";
     }
     // Echo | Main Content
     $output .= '<div class="blog_wrapper isotope_wrapper clearfix">';
     $output .= '<div class="posts_group lm_wrapper col-' . $columns . ' ' . $classes . '">';
     $output .= mfn_content_post($query_blog, $style, $load_more);
     $output .= '</div>';
     if ($pagination) {
         $output .= mfn_pagination($query_blog, $load_more);
     }
     $output .= '</div>' . "\n";
     $output .= '</div>' . "\n";
     wp_reset_postdata();
     return $output;
 }
예제 #2
0
 function mfn_content_post($query = false, $style = false, $load_more = false)
 {
     global $wp_query;
     $output = '';
     $translate['published'] = mfn_opts_get('translate') ? mfn_opts_get('translate-published', 'Published by') : __('Published by', 'betheme');
     $translate['at'] = mfn_opts_get('translate') ? mfn_opts_get('translate-at', 'at') : __('at', 'betheme');
     $translate['categories'] = mfn_opts_get('translate') ? mfn_opts_get('translate-categories', 'Categories') : __('Categories', 'betheme');
     $translate['like'] = mfn_opts_get('translate') ? mfn_opts_get('translate-like', 'Do you like it?') : __('Do you like it?', 'betheme');
     $translate['readmore'] = mfn_opts_get('translate') ? mfn_opts_get('translate-readmore', 'Read more') : __('Read more', 'betheme');
     if (!$query) {
         $query = $wp_query;
     }
     if (!$style) {
         if ($_GET && key_exists('mfn-b', $_GET)) {
             $style = $_GET['mfn-b'];
             // demo
         } else {
             $style = mfn_opts_get('blog-layout', 'classic');
         }
     }
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             // classes
             $post_class = array('post-item', 'isotope-item', 'clearfix');
             if (!mfn_post_thumbnail(get_the_ID())) {
                 $post_class[] = 'no-img';
             }
             if (post_password_required()) {
                 $post_class[] = 'no-img';
             }
             $post_class[] = 'author-' . mfn_slug(get_the_author_meta('user_login'));
             $post_class = implode(' ', get_post_class($post_class));
             // background color | Style - Masonry Tiles
             $bg_color = get_post_meta(get_the_ID(), 'mfn-post-bg', true);
             if ($bg_color && $style == 'masonry tiles') {
                 $bg_color = 'style="background-color:' . $bg_color . ';"';
             }
             $output .= '<div class="' . $post_class . '" ' . $bg_color . '>';
             // icon | Style == Masonry Tiles
             if ($style == 'masonry tiles') {
                 if (get_post_format() == 'video') {
                     $output .= '<i class="post-format-icon icon-play"></i>';
                 } elseif (get_post_format() == 'quote') {
                     $output .= '<i class="post-format-icon icon-quote"></i>';
                 } elseif (get_post_format() == 'link') {
                     $output .= '<i class="post-format-icon icon-link"></i>';
                 } elseif (get_post_format() == 'audio') {
                     // for future use
                     $output .= '<i class="post-format-icon icon-music-line"></i>';
                 } else {
                     $rev_slider = get_post_meta(get_the_ID(), 'mfn-post-slider', true);
                     $lay_slider = get_post_meta(get_the_ID(), 'mfn-post-slider-layer', true);
                     if ($rev_slider || $lay_slider) {
                         $output .= '<i class="post-format-icon icon-code"></i>';
                     }
                 }
             }
             // date | Style == Timeline
             $output .= '<div class="date_label">' . get_the_date() . '</div>';
             // photo --------------------------------------------------------------------------
             if (!post_password_required()) {
                 if ($style == 'masonry tiles') {
                     // photo | Style != Masonry Tiles
                     $output .= '<div class="post-photo-wrapper scale-with-grid">';
                     $output .= get_the_post_thumbnail(get_the_ID(), 'full', array('class' => 'scale-with-grid', 'itemprop' => 'image'));
                     $output .= '</div>';
                 } else {
                     // photo | Style == *
                     $output .= '<div class="image_frame post-photo-wrapper scale-with-grid">';
                     $output .= '<div class="image_wrapper">';
                     $output .= mfn_post_thumbnail(get_the_ID(), 'blog', $style, $load_more);
                     $output .= '</div>';
                     $output .= '</div>';
                 }
             }
             // desc ---------------------------------------------------------------------------
             $output .= '<div class="post-desc-wrapper">';
             $output .= '<div class="post-desc">';
             // head -------------------------------------
             $output .= '<div class="post-head">';
             // meta -------------------------------------
             if (mfn_opts_get('blog-meta')) {
                 $output .= '<div class="post-meta clearfix">';
                 $output .= '<div class="author-date">';
                 $output .= '<span class="vcard author post-author">';
                 $output .= '<span class="label">' . $translate['published'] . ' </span>';
                 $output .= '<i class="icon-user"></i> ';
                 $output .= '<span class="fn"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a></span>';
                 $output .= '</span> ';
                 $output .= '<span class="date">';
                 $output .= '<span class="label">' . $translate['at'] . ' </span>';
                 $output .= '<i class="icon-clock"></i> ';
                 $output .= '<span class="post-date updated">' . get_the_date() . '</span>';
                 $output .= '</span>';
                 // .post-comments | Style == Masonry Tiles
                 if ($style == 'masonry tiles' && comments_open() && mfn_opts_get('blog-comments')) {
                     $output .= '<div class="post-links">';
                     $output .= '<i class="icon-comment-empty-fa"></i> <a href="' . get_comments_link() . '" class="post-comments">' . get_comments_number() . '</a>';
                     $output .= '</div>';
                 }
                 $output .= '</div>';
                 $output .= '<div class="category">';
                 $output .= '<span class="cat-btn">' . $translate['categories'] . ' <i class="icon-down-dir"></i></span>';
                 $output .= '<div class="cat-wrapper">' . get_the_category_list() . '</div>';
                 $output .= '</div>';
                 $output .= '</div>';
             }
             // .post-footer | Style == Photo
             if ($style == 'photo') {
                 $output .= '<div class="post-footer">';
                 $output .= '<div class="button-love"><span class="love-text">' . $translate['like'] . '</span>' . mfn_love() . '</div>';
                 $output .= '<div class="post-links">';
                 if (comments_open() && mfn_opts_get('blog-comments')) {
                     $output .= '<i class="icon-comment-empty-fa"></i> <a href="' . get_comments_link() . '" class="post-comments">' . get_comments_number() . '</a>';
                 }
                 $output .= '<i class="icon-doc-text"></i> <a href="' . get_permalink() . '" class="post-more">' . $translate['readmore'] . '</a>';
                 $output .= '</div>';
                 $output .= '</div>';
             }
             $output .= '</div>';
             // title -------------------------------------
             $output .= '<div class="post-title">';
             if (get_post_format() == 'quote') {
                 // quote ----------------------------
                 $output .= '<blockquote><a href="' . get_permalink() . '">' . get_the_title() . '</a></blockquote>';
             } elseif (get_post_format() == 'link') {
                 // link ----------------------------
                 $output .= '<i class="icon-link"></i>';
                 $output .= '<div class="link-wrapper">';
                 $output .= '<h4>' . get_the_title() . '</h4>';
                 $link = get_post_meta(get_the_ID(), 'mfn-post-link', true);
                 $output .= '<a target="_blank" href="' . $link . '">' . $link . '</a>';
                 $output .= '</div>';
             } else {
                 // default ----------------------------
                 $output .= '<h2 class="entry-title" itemprop="headline"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
             }
             $output .= '</div>';
             // content -------------------------------------
             $output .= '<div class="post-excerpt">' . get_the_excerpt() . '</div>';
             // .post-footer | Style != Photo, Masonry Tiles
             if (!in_array($style, array('photo', 'masonry tiles'))) {
                 $output .= '<div class="post-footer">';
                 $output .= '<div class="button-love"><span class="love-text">' . $translate['like'] . '</span>' . mfn_love() . '</div>';
                 $output .= '<div class="post-links">';
                 if (comments_open() && mfn_opts_get('blog-comments')) {
                     $output .= '<i class="icon-comment-empty-fa"></i> <a href="' . get_comments_link() . '" class="post-comments">' . get_comments_number() . '</a>';
                 }
                 $output .= '<i class="icon-doc-text"></i> <a href="' . get_permalink() . '" class="post-more">' . $translate['readmore'] . '</a>';
                 $output .= '</div>';
                 $output .= '</div>';
             }
             $output .= '</div>';
             $output .= '</div>';
             $output .= '</div>';
         }
     }
     return $output;
 }
예제 #3
0
    echo '<li class="reset-inner"><a data-rel="*" href="' . get_permalink(mfn_ID()) . '">' . $translate['item-all'] . '</a></li>';
    if ($tags = get_tags()) {
        foreach ($tags as $tag) {
            echo '<li><a data-rel=".tag-' . $tag->slug . '" href="' . get_tag_link($tag) . '">' . $tag->name . '</a></li>';
        }
    }
    ?>
									<li class="close"><a href="#"><i class="icon-cancel"></i></a></li>
								</ul>
								<ul class="authors">
									<?php 
    echo '<li class="reset-inner"><a data-rel="*" href="' . get_permalink(mfn_ID()) . '">' . $translate['item-all'] . '</a></li>';
    $authors = mfn_get_authors();
    if (is_array($authors)) {
        foreach ($authors as $auth) {
            echo '<li><a data-rel=".author-' . mfn_slug($auth->data->user_login) . '" href="' . get_author_posts_url($auth->ID) . '">' . $auth->data->display_name . '</a></li>';
        }
    }
    ?>
									<li class="close"><a href="#"><i class="icon-cancel"></i></a></li>
								</ul>
							</div>
									
						</div>
						
					</div>
				</div>
			<?php 
}
?>