コード例 #1
0
ファイル: widgets.php プロジェクト: jimdough/Roadmaster
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $query_args = array();
        $query_args['categories'] = empty($instance['categories']) ? array() : $instance['categories'];
        $query_args['relation'] = isset($instance['relation']) ? $instance['relation'] : 'OR';
        $query_args['tags'] = empty($instance['tags']) ? array() : $instance['tags'];
        $query_args['posts_per_page'] = isset($instance['number_of_article']) ? $instance['number_of_article'] : -1;
        $query_args['orderby'] = isset($instance['orderby']) ? $instance['orderby'] : 'latest';
        if (isset($instance['kopa_timestamp'])) {
            $query_args['date_query'] = $instance['kopa_timestamp'];
        }
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $posts = kopa_widget_posttype_build_query($query_args);
        if ($posts->have_posts()) {
            ?>
            
            <?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>

                <div class="widget kp-article-list-widget clearfix">
                    <article class="entry-item clearfix">
                        <?php 
                if (has_post_thumbnail()) {
                    ?>
                        <div class="entry-thumb">
                            <a href="<?php 
                    the_permalink();
                    ?>
"><img src="<?php 
                    echo kopa_get_image_src(get_the_ID(), 'article-list-image-size');
                    ?>
" alt="<?php 
                    echo get_the_title();
                    ?>
"></a>
                        </div>
                        <?php 
                }
                ?>
                        <div class="entry-content">
                            <h4 class="entry-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
                            <span class="entry-date">&mdash; <?php 
                the_time(get_option('date_format'));
                ?>
</span>
                            <?php 
                the_excerpt();
                ?>
                        </div>
                    </article>
                </div>

            <?php 
            }
            // endwhile
            ?>

        <?php 
        }
        // endif
        ?>

        <?php 
        wp_reset_postdata();
        echo $after_widget;
    }
コード例 #2
0
ファイル: loop-blog.php プロジェクト: jimdough/Roadmaster
        the_ID();
        ?>
" <?php 
        post_class('entry-item clearfix');
        ?>
>
            <div class="entry-thumb">
                <?php 
        if (has_post_thumbnail()) {
            ?>
                    <a href="<?php 
            the_permalink();
            ?>
">
                        <img src="<?php 
            echo kopa_get_image_src(get_the_ID(), 'kopa-image-size-4');
            // 53x53
            ?>
" alt="<?php 
            echo get_the_title();
            ?>
">
                    </a>
                    <div class="meta-box">
                        <span class="entry-comments"><?php 
            echo KopaIcon::getIcon('comment', 'span');
            comments_popup_link();
            ?>
</span>
                        <span class="entry-view"><?php 
            echo KopaIcon::getIcon('view', 'span');
コード例 #3
0
        
    <div class="entry-thumb">
        <?php 
//$gallery = kopa_content_get_gallery( get_the_content() );
//if ( isset( $gallery[0] ) ) {
//    $gallery = $gallery[0];
//    if ( isset( $gallery['shortcode'] ) ) {
//        echo do_shortcode( $gallery['shortcode'] );
//    }
//} else {
if (has_post_thumbnail()) {
    $kopa_post_thumbnail_size = 'kopa-image-size-6';
    // 665x363
    ?>
                <img src=<?php 
    echo kopa_get_image_src(get_the_ID(), $kopa_post_thumbnail_size);
    ?>
 alt="<?php 
    echo get_the_title();
    ?>
" >
                <?php 
}
//}
?>
    </div>

    <header>
        <h4 class="entry-title"><?php 
echo get_the_title();
?>
コード例 #4
0
ファイル: format-single.php プロジェクト: jimdough/Roadmaster
<div id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>
                        
    <?php 
if (has_post_thumbnail() && 'show' == get_option('kopa_theme_options_featured_image_status', 'show')) {
    ?>
        <div class="entry-thumb">
            <img src="<?php 
    echo kopa_get_image_src(get_the_ID(), 'medium');
    ?>
" alt="<?php 
    echo get_the_title();
    ?>
">
        </div>
    <?php 
}
?>
    <header>
        <h4 class="entry-title"><?php 
the_title();
?>
</h4>
        <span class="entry-date">&mdash; <?php 
the_time(get_option('date_format'));
?>
コード例 #5
0
ファイル: front.php プロジェクト: abhinay100/wordpress_dash
function kopa_get_related_articles()
{
    if (is_single()) {
        $get_by = get_option('kopa_theme_options_post_related_get_by', 'post_tag');
        if ('hide' != $get_by) {
            $limit = (int) get_option('kopa_theme_options_post_related_limit', 4);
            if ($limit > 0) {
                global $post;
                $taxs = array();
                if ('category' == $get_by) {
                    $cats = get_the_category($post->ID);
                    if ($cats) {
                        $ids = array();
                        foreach ($cats as $cat) {
                            $ids[] = $cat->term_id;
                        }
                        $taxs[] = array('taxonomy' => 'category', 'field' => 'id', 'terms' => $ids);
                    }
                } else {
                    $tags = get_the_tags($post->ID);
                    if ($tags) {
                        $ids = array();
                        foreach ($tags as $tag) {
                            $ids[] = $tag->term_id;
                        }
                        $taxs[] = array('taxonomy' => 'post_tag', 'field' => 'id', 'terms' => $ids);
                    }
                }
                if ($taxs) {
                    $related_args = array('tax_query' => $taxs, 'post__not_in' => array($post->ID), 'posts_per_page' => $limit);
                    $related_posts = new WP_Query($related_args);
                    if ($related_posts->have_posts()) {
                        $post_index = 1;
                        ?>
                        <div class="kopa-related-post">
                            <h3><?php 
                        _e('Related Articles', kopa_get_domain());
                        ?>
</h3>
                            <ul class="clearfix">
                                <?php 
                        while ($related_posts->have_posts()) {
                            $related_posts->the_post();
                            ?>
 
                                    <li>
                                        <article class="entry-item clearfix">
                                            <?php 
                            if (has_post_thumbnail()) {
                                ?>
                                                <div class="entry-thumb">
                                                    <a href="<?php 
                                the_permalink();
                                ?>
"><img src="<?php 
                                echo kopa_get_image_src(get_the_ID(), 'article-list-sm-image-size');
                                ?>
" alt="<?php 
                                echo get_the_title();
                                ?>
" ></a>
                                                </div>
                                            <?php 
                            }
                            // endif
                            ?>
                                            <div class="entry-content">
                                                <h4 class="entry-title"><a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></h4>
                                                <span class="entry-date"><span class="kopa-minus"></span> <?php 
                            the_time(get_option('date_format'));
                            ?>
</span>
                                            </div>
                                        </article>
                                    </li>
                                    <?php 
                            if ($post_index % 2 == 0) {
                                echo '<div class="clear"></div>';
                            }
                            $post_index++;
                            ?>
                                <?php 
                        }
                        // endwhile
                        ?>
                            </ul>
                        </div><!--kopa-related-post-->
                        <?php 
                    }
                    // endif
                    wp_reset_postdata();
                }
            }
        }
    }
}
コード例 #6
0
    echo $kopa_blog_slider_settings['autoplay'];
    ?>
" data-direction="horizontal">
            <ul class="slides">
            <?php 
    while ($kopa_blog_slider_posts->have_posts()) {
        $kopa_blog_slider_posts->the_post();
        ?>
               
                    <li>
                        <article>
							<?php 
        if (has_post_thumbnail()) {
            ?>
                            <img src="<?php 
            echo kopa_get_image_src(get_the_ID(), $kopa_blog_slider_image_size);
            ?>
" alt="<?php 
            echo get_the_title();
            ?>
">
                            <?php 
        } else {
            ?>
							<img src="http://placehold.it/720x480&text=No+Image+Available" alt="<?php 
            echo get_the_title();
            ?>
">
							<?php 
        }
        // endif
コード例 #7
0
                    <ul class="clearfix">
                        <?php 
                    while ($related_posts->have_posts()) {
                        $related_posts->the_post();
                        ?>
                        <li>
                            <article class="entry-item clearfix">
                                <?php 
                        if (has_post_thumbnail()) {
                            ?>
                                <div class="entry-thumb">
                                    <a href="<?php 
                            the_permalink();
                            ?>
"><img src="<?php 
                            echo kopa_get_image_src(get_the_ID(), 'article-list-sm-image-size');
                            ?>
" alt="<?php 
                            echo get_the_title();
                            ?>
" ></a>
                                </div>
                                <?php 
                        }
                        // endif
                        ?>
                                <div class="entry-content">
                                    <h4 class="entry-title"><a href="<?php 
                        the_permalink();
                        ?>
"><?php 
コード例 #8
0
ファイル: widgets.php プロジェクト: jimdough/Roadmaster
    function show_entry_list_style_1($query_args)
    {
        $posts = kopa_widget_posttype_build_query($query_args);
        if ($posts->have_posts()) {
            $post_index = 1;
            while ($posts->have_posts()) {
                $posts->the_post();
                if ($post_index == 1) {
                    // show the thumbnail of the first post
                    ?>
                    <article class="entry-item">
                        <div class="entry-thumb">
                            <?php 
                    if (get_post_format() == 'gallery') {
                        ?>

                                <div class="entry-thumb-slider flexslider">
                                    <ul class="slides">
                                        <?php 
                        if (has_post_thumbnail()) {
                            ?>
                                            <li><img src="<?php 
                            echo kopa_get_image_src(get_the_ID(), 'kopa-image-size-4');
                            ?>
" alt="<?php 
                            echo get_the_title();
                            ?>
"></li>
                                        <?php 
                        }
                        $gallery = kopa_content_get_gallery(get_the_content());
                        if (isset($gallery[0])) {
                            $gallery = $gallery[0];
                        } else {
                            $gallery = '';
                        }
                        if (isset($gallery['shortcode'])) {
                            $shortcode = $gallery['shortcode'];
                        } else {
                            $shortcode = '';
                        }
                        // get gallery string ids
                        preg_match_all('/ids=\\"(?:\\d+,*)+\\"/', $shortcode, $gallery_string_ids);
                        if (isset($gallery_string_ids[0][0])) {
                            $gallery_string_ids = $gallery_string_ids[0][0];
                        } else {
                            $gallery_string_ids = '';
                        }
                        // get array of image id
                        preg_match_all('/\\d+/', $gallery_string_ids, $gallery_ids);
                        if (isset($gallery_ids[0])) {
                            $gallery_ids = $gallery_ids[0];
                        } else {
                            $gallery_ids = '';
                        }
                        if (!empty($gallery_ids)) {
                            foreach ($gallery_ids as $gallery_id) {
                                if (wp_attachment_is_image($gallery_id)) {
                                    echo '<li>' . wp_get_attachment_image($gallery_id, 'kopa-image-size-4') . '</li>';
                                }
                            }
                        }
                        ?>
                                    </ul><!--slides-->
                                </div><!--entry-thumb-slider-->

                            <?php 
                    } elseif (get_post_format() == 'video') {
                        $video = kopa_content_get_video(get_the_content());
                        if (isset($video[0])) {
                            $video = $video[0];
                            if (isset($video['url']) && !empty($video['url'])) {
                                ?>
                                            <a class="play-icon" href="<?php 
                                echo esc_url($video['url']);
                                ?>
" rel="prettyPhoto[<?php 
                                echo $this->get_field_id('video');
                                ?>
]"></a>
                            <?php 
                            }
                            // endif isset( $video['url']
                        }
                        // endif isset( $video[0] )
                        ?>
                                    <a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        if (has_post_thumbnail()) {
                            ?>
                                        <img src="<?php 
                            echo kopa_get_image_src(get_the_ID(), 'kopa-image-size-4');
                            // 53x53
                            ?>
" alt="<?php 
                            echo get_the_title();
                            ?>
">
                                    <?php 
                        } elseif (isset($video['url']) && isset($video['type'])) {
                            echo '<img src="' . kopa_get_video_thumbnails_url($video['type'], $video['url']) . '">';
                        }
                        ?>
</a>
                            <?php 
                    } else {
                        ?>
                                <?php 
                        if (has_post_thumbnail()) {
                            ?>
 
                                    <a href="<?php 
                            the_permalink();
                            ?>
">
                                        <img src="<?php 
                            echo kopa_get_image_src(get_the_ID(), 'kopa-image-size-4');
                            // 53x53
                            ?>
" alt="<?php 
                            echo get_the_title();
                            ?>
">
                                    </a>
                                <?php 
                        }
                        ?>
                            <?php 
                    }
                    ?>
                        </div>
                        <div class="entry-content">
                            <header>
                                <h4 class="entry-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo get_the_title();
                    ?>
</a></h4>
                                <span class="entry-date"><span class="kopa-minus"></span><?php 
                    the_time(get_option('date_format'));
                    ?>
</span>
                            </header>
                            <?php 
                    the_excerpt();
                    ?>
                        </div>
                    </article><!--entry-item-->

        <?php 
                    echo $posts->post_count > 1 ? '<ul class="older-post">' : '';
                } else {
                    // $post_index != 1 ( the rest posts )
                    ?>
                    <li>
                        <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo get_the_title();
                    ?>
</a>
                        <?php 
                    the_excerpt();
                    ?>
                    </li>
        <?php 
                }
                // endif $post_index == 1
                $post_index++;
                // increase post index by 1
            }
            // endwhile $posts->have_posts()
            echo $posts->post_count > 1 ? '</ul><!-- .older-post -->' : '';
        } else {
            // if ! $posts->have_posts()
            _e('No Posts Found', kopa_get_domain());
        }
        wp_reset_postdata();
    }