コード例 #1
0
if (have_posts()) {
    while (have_posts()) {
        the_post();
        echo '<article id="post-' . get_the_ID() . '" class="row clearfix ' . implode(' ', get_post_class()) . '">';
        $container_class = 'col-sm-12';
        if (has_post_thumbnail()) {
            $container_class = 'col-sm-9';
            echo '<div class="col-sm-3">';
            echo zn_get_post_image(get_the_id(), '270', '170');
            echo '</div>';
        }
        echo '<div class="' . $container_class . '">';
        // ARTICLE TITLE
        echo '<h3 class="article_title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h3>';
        // ARTICLE META
        echo zn_get_the_meta();
        // POST CONTENT
        $excerpt = trim(get_the_excerpt());
        if (!empty($excerpt)) {
            the_excerpt();
            echo '<a href="' . get_permalink() . '" rel="bookmark"><span class="arrowLink arrowRight">' . __('Continue reading', 'zn_framework') . '</span></a>';
        } else {
            $excerpt = strip_shortcodes(get_the_content());
            $excerpt = apply_filters('the_excerpt', $excerpt);
            $excerpt = str_replace(']]>', ']]&gt;', $excerpt);
            echo $excerpt;
            if (!empty($excerpt)) {
                echo '<a href="' . get_permalink() . '" rel="bookmark"><span class="arrowLink arrowRight">' . __('Continue reading', 'zn_framework') . '</span></a>';
            }
        }
        echo '</div>';
コード例 #2
0
 function zn_setup_post_data($post_format)
 {
     global $zn_config, $post;
     $content_type = !empty($zn_config['blog_content']) ? $zn_config['blog_content'] : 'content';
     $imgBig = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()));
     $size = zn_get_wp_image_size($zn_config['size']);
     $imgAttr = array('data-mfp-src' => $imgBig, 'class' => "img-responsive animate magPopupImg");
     $post_data['media'] = zn_get_post_image(get_the_ID(), $size['width'], $size['height'], $imgAttr);
     //$post_data['media']   = get_the_post_thumbnail(get_the_ID(), $zn_config['size'] , array( 'class' => 'animate img-responsive magPopupImg' , 'data-mfp-src' => wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ) ));
     $post_data['title'] = get_the_title();
     $post_data['content'] = $content_type == 'content' ? get_the_content('<span class="arrowLink arrowRight">' . __('Continue reading', 'zn_framework') . '</span>') : get_the_excerpt();
     //$post_data['content'] = get_the_excerpt();
     $post_data['meta'] = zn_get_the_meta();
     // Separate post content and media
     $post_data = apply_filters('post-format-' . $post_format, $post_data, $zn_config['size']);
     // Apply the 'the_content' filter
     $post_data['content'] = apply_filters('the_content', $post_data['content']);
     // TRIM THE CONTENT FOR SPECIAL PAGEBUILDEr ELEMENTS
     if (!empty($zn_config['trim_content'])) {
         $post_data['content'] = zn_trim_content($post_data['content']);
     }
     // HIDE THE POST META FOR SPECIAL PAGE BUILDEr ELEMENETS
     if (!empty($zn_config['hide_post_meta']) && $zn_config['hide_post_meta'] == true) {
         $post_data['meta'] = '';
     }
     // WRAP POST MEDIA
     if ($post_format == 'video' || $post_format == 'gallery' || $post_format == 'standard') {
         $media_cls = 'scaleRotateImg';
     } else {
         $media_cls = '';
     }
     //** Appear animation
     $blog_media_delay = zget_option('blog_media_delay', 'blog_options');
     $blog_media_animation = zget_option('blog_media_animation', 'blog_options');
     $appear_delay = $blog_media_delay ? $blog_media_delay : '0';
     $appear = $blog_media_animation ? $blog_media_animation : '';
     if (!empty($appear)) {
         $appear = 'data-appear="fade-in" data-appear-direction="' . $appear . '" data-appear-delay="' . $appear_delay . '"';
     }
     $post_data['media'] = !empty($post_data['media']) ? '<div class="mediaContainer ' . $media_cls . '" ' . $appear . '>' . $post_data['media'] . '</div>' : '';
     // CHECK TO SEE IF WE NEED TO WRAP THE ARTICLE
     $post_data['before'] = is_single() ? '' : '<div class="' . $zn_config['columns'] . ' article_container animate" >';
     $post_data['after'] = is_single() ? '' : '</div>';
     return $post_data;
 }