Example #1
0
 function be_recent_posts_style2($atts, $content)
 {
     extract(shortcode_atts(array('number' => 3), $atts));
     $posts_per_page = isset($number) && !empty($number) ? $number : 3;
     $args = array('post_type' => 'post', 'posts_per_page' => $posts_per_page, 'orderby' => 'date', 'ignore_sticky_posts' => 1, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote'), 'operator' => 'NOT IN')));
     $output = '';
     global $meta_sep, $blog_attr;
     $my_query = new WP_Query($args);
     if ($my_query->have_posts()) {
         $output .= '<div class="clearfix related-items bar-style-related-posts">';
         $blog_attr['style'] = 'shortcodes';
         $blog_attr['gutter_width'] = 0;
         while ($my_query->have_posts()) {
             $my_query->the_post();
             $style = '';
             if (has_post_thumbnail()) {
                 $blog_image_size = 'blog-image';
                 $thumb_full = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
                 $attachment_full_url = $thumb_full[0];
                 $style = 'background: url(' . $attachment_full_url . ') center center no-repeat;';
             }
             $output .= '<div class="clearfix bar-style-related-posts-list be-bg-cover" style="' . $style . '">';
             $output .= '<div class="background-content">';
             $output .= '<div class="special-subtitle post-date">' . get_the_date('F d Y') . '</div>';
             if (get_the_title(get_the_ID())) {
                 $output .= '<a href="' . get_the_permalink() . '"><h5 class="post-title">' . get_the_title(get_the_ID()) . '</h5></a>';
             }
             $output .= '<nav class="post-nav meta-font secondary_text">';
             $output .= '<div class="sep-with-icon-wrap margin-bottom"><span class="sep-with-icon" style="height:2px; width:20px;"></span><i class="sep-icon font-icon icon-dimond"></i><span class="sep-with-icon" style="height:2px; width:20px;"></span></div>';
             $output .= '<ul class="clearfix cal-list">';
             $output .= '<li class="post-meta post-author">' . __('Posted By :', 'be-themes') . ' ' . get_the_author() . '<span class="post-meta-sep"> / </span></li>';
             $output .= '<li class="post-meta post-comments"><a href="' . get_comments_link() . '">' . get_comments_number('0', '1', '%') . ' ' . __(' comments', 'be-themes') . '</a> <span class="post-meta-sep">/</span></li>';
             $output .= '<li class="post-meta post-category">' . __('Under :', 'be-themes');
             $output .= be_themes_get_category_list(get_the_ID());
             $output .= '</li>';
             $output .= '</ul></nav>';
             $output .= '</div>';
             $output .= '<div class="background-overlay"></div>';
             $output .= '</div>';
             // end column block
         }
         $output .= '</div>';
     }
     wp_reset_query();
     return $output;
 }
Example #2
0
 function get_be_themes_breadcrumb()
 {
     global $post;
     $sep = '  /  ';
     $output = '';
     if (!is_front_page()) {
         $output .= '<div class="breadcrumbs">';
         $output .= '<a href="';
         $output .= home_url();
         $output .= '">';
         $output .= __('Home', 'be-themes');
         $output .= '</a>' . $sep;
         if (is_category() && !is_singular('portfolio')) {
             $output .= be_themes_get_category_list(get_the_ID());
             $output .= $sep;
         } else {
             if (is_singular('post')) {
                 $blog_page_id = get_option('page_for_posts');
                 if ($blog_page_id) {
                     $output .= '<a href="' . get_permalink($blog_page_id) . '">' . __('Blog', 'be-themes') . '</a>';
                     $output .= $sep;
                 }
             } else {
                 if (is_singular('product')) {
                     $shop_page_id = woocommerce_get_page_id('shop');
                     if ($shop_page_id) {
                         $output .= '<a href="' . get_permalink($shop_page_id) . '">' . __('Shop', 'be-themes') . '</a>';
                         $output .= $sep;
                     }
                 } elseif ((is_archive() || is_single()) && (is_tax('portfolio_categories') || is_tax('portfolio_tags'))) {
                     global $wp_query;
                     $term = $wp_query->queried_object;
                     if (is_day()) {
                         $output .= __(get_the_date(), 'be-themes');
                     } elseif (is_month()) {
                         $output .= __(get_the_date(_x('F Y', 'monthly archives date format', 'be-themes')));
                     } elseif (is_year()) {
                         $output .= __(get_the_date(_x('Y', 'yearly archives date format', 'be-themes')));
                     } elseif (is_tax('portfolio_categories')) {
                         $output .= __('Portfolio Category / ', 'be-themes') . '<a href="' . get_term_link($term->term_id, 'portfolio_categories') . '" >' . $term->name . '</a>';
                     } elseif (is_tax('portfolio_tags')) {
                         $output .= __('Portfolio Tag / ', 'be-themes') . '<a href="' . get_term_link($term->term_id, 'portfolio_tags') . '" >' . $term->name . '</a>';
                     } else {
                         $output .= __('Portfolio Archives', 'be-themes');
                     }
                 } elseif ((is_archive() || is_single()) && !is_singular('portfolio')) {
                     if (is_day()) {
                         $output .= __(get_the_date(), 'be-themes');
                     } elseif (is_month()) {
                         $output .= __(get_the_date(_x('F Y', 'monthly archives date format', 'be-themes')));
                     } elseif (is_year()) {
                         $output .= __(get_the_date(_x('Y', 'yearly archives date format', 'be-themes')));
                     } else {
                         $output .= __('Blog Archives', 'be-themes');
                     }
                 }
             }
         }
         if (is_singular('portfolio')) {
             $output .= get_the_term_list($post->ID, 'portfolio_categories', '', '  /  ');
             $output .= $sep;
         }
         if (is_single()) {
             $output .= __('Here', 'be-themes');
         }
         if (is_page()) {
             $parents = get_ancestors(get_the_ID(), 'page');
             if (!empty($parents)) {
                 foreach ($parents as $parent) {
                     $output .= '<a href="' . get_permalink($parent) . '">' . get_the_title($parent) . '</a> / ';
                 }
             }
             $output .= get_the_title();
         }
         if (is_home()) {
             global $post;
             $page_for_posts_id = get_option('page_for_posts');
             if ($page_for_posts_id) {
                 $post = get_page($page_for_posts_id);
                 setup_postdata($post);
                 get_the_title();
                 rewind_posts();
                 $output .= __('Blog', 'be-themes');
             }
         }
         $output .= '</div>';
     }
     return $output;
 }