コード例 #1
0
ファイル: ninesquare.php プロジェクト: MenZil-Team/gulzar
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        if ($instance['title'] != '') {
            echo $before_title . $instance['title'] . $after_title;
        }
        echo '<div id="faxian_widget" class="faxian_widget"><div class="full" style="display:none;"><a class="faxian_href" href="" target="_blank" ><img class="faxian_widget_img" width="250" height="250"/><div class="faxian_widget_title"></div></a></div>';
        $args = array('post_type' => $instance['post_type'], 'showposts' => '8');
        $new_query = new WP_Query($args);
        if ($new_query->have_posts()) {
            echo '<ul>';
            while ($new_query->have_posts()) {
                $new_query->the_post();
                ?>
				<li><a href="<?php 
                echo get_permalink($new_query->post->ID);
                ?>
" target="_blank" class="relateFxPic">
				<?php 
                if (has_post_thumbnail()) {
                    $thumb_id = get_post_thumbnail_id($new_query->post->ID);
                    $thumb = wp_get_attachment_image_src($thumb_id, array(250, 250));
                    $url = $thumb[0];
                } else {
                    $url = get_post_img($new_query->post->ID, 250, 250);
                }
                ?>
				
				<img src="<?php 
                echo $url;
                ?>
"  height="77" width="77" title="<?php 
                echo $new_query->post->post_title;
                ?>
" alt="<?php 
                echo $new_query->post->post_title;
                ?>
"/>
				</a></li>
			<?php 
            }
            if ($instance['more_link'] != '') {
                $more_link = $instance['more_link'];
            } else {
                $more_link = get_post_type_archive_link($instance['post_type']);
            }
            echo '<li><a href="' . $more_link . '" class="relateFxPic relateMore" target="_blank">&nbsp;</a></li></ul></div>';
        }
        echo $after_widget;
    }
コード例 #2
0
ファイル: index.php プロジェクト: wangshijun101/morketing.cn
 / <?php 
        echo getPostViews(get_the_ID());
        ?>
 次浏览 / <a href="<?php 
        the_permalink();
        ?>
#comments" title="《<?php 
        the_title();
        ?>
》上的评论"><?php 
        comments_popup_link('抢沙发', '2 次吐槽', '% 次吐槽', '', '吐槽系统没启动');
        ?>
</a></p>
               <div class="list-content">
		<?php 
        $thumb_img = has_post_thumbnail() ? get_the_post_thumbnail($post->ID, array(730, 300), array('alt' => trim(strip_tags($post->post_title)), 'title' => trim(strip_tags($post->post_title)))) : get_post_img(730, 300, 1);
        ?>
<div class="thumbnail_box">
<div class="thumbnail">
<a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title();
        ?>
">
<?php 
        echo $thumb_img;
        ?>
</a></div></div>
<div class="entry-content"><?php 
コード例 #3
0
 /**
  * 标签文章
  * @param int $id 指定标签的文章
  */
 public function tag($id)
 {
     $Tag = new TagsLogic();
     $Posts = new PostsLogic();
     $tag = $Tag->detail($id);
     $posts_id = $Tag->getPostsId($tag['cat_id']);
     $count = sizeof($posts_id);
     if (!empty($posts_id)) {
         $Page = new GreenPage($count, get_opinion('PAGER'));
         $limit = $Page->firstRow . ',' . $Page->listRows;
         $res = $Posts->getList($limit, 'single', 'post_date desc', true, array(), $posts_id);
         foreach ($res as $key => $value) {
             $res[$key]['post_content'] = strip_tags($res[$key]['post_content']);
             $res[$key]['post_url'] = U('Api/Index/post', array('id' => $res[$key]['post_id']), false, true);
             $res[$key]["post_img"] = get_post_img($value);
         }
         $res_array["posts"] = $res;
         $this->jsonReturn(1, $res_array);
     } else {
         $res_array["detail"] = "没有文章";
         $this->jsonReturn(0, $res_array);
     }
 }
コード例 #4
0
ファイル: posts_list.php プロジェクト: MenZil-Team/gulzar
    function widget($args, $instance)
    {
        extract($args);
        if ($instance['order'] == 'view') {
            echo '<div class="widget widget_featured" id="widget_featured">';
        } elseif ($instance['order'] == 'comment') {
            echo '<div class="widget widget_popular" id="widget_featured">';
        } elseif ($instance['order'] == 'new') {
            echo '<div class="widget widget_latest" id="widget_featured">';
        } else {
            echo '<div class="widget widget_random" id="widget_featured">';
        }
        if ($instance['title'] != '') {
            echo $before_title . $instance['title'] . $after_title;
        }
        $count = (int) $instance["number"];
        if ($instance['order'] == 'view') {
            $args = array('post__not_in' => get_option('sticky_posts'), 'posts_per_page' => $count, 'orderby' => 'meta_value', 'meta_query' => array(array('key' => 'post_views_count')));
        } elseif ($instance['order'] == 'comment') {
            $args = array('post__not_in' => get_option('sticky_posts'), 'posts_per_page' => $count, 'orderby' => 'comment_count');
        } elseif ($instance['order'] == 'new') {
            $args = array('post__not_in' => get_option('sticky_posts'), 'showposts' => $count, 'offset' => 1);
        } else {
            $args = array('post__not_in' => get_option('sticky_posts'), 'showposts' => $count, 'orderby' => 'rand');
        }
        $new_query = new WP_Query($args);
        if ($new_query->have_posts()) {
            echo '<ul>';
            while ($new_query->have_posts()) {
                $new_query->the_post();
                ?>
				<li>
				<div  class="div1"> 
				<dl>
					<dt>
					<a href="<?php 
                echo get_permalink($new_query->post->ID);
                ?>
" target="_blank" rel="nofollow">
					<?php 
                if (has_post_thumbnail()) {
                    $thumb_id = get_post_thumbnail_id($new_query->post->ID);
                    $thumb = wp_get_attachment_image_src($thumb_id, array(60, 60));
                    $url = $thumb[0];
                } else {
                    $url = get_post_img($new_query->post->ID, 60, 60);
                }
                ?>
						<img src="<?php 
                echo $url;
                ?>
" height="60" width="60" title="<?php 
                the_title();
                ?>
" alt="<?php 
                the_title();
                ?>
" />
						</a>
						</dt>
						<dd><a  target="_blank" href="<?php 
                echo get_permalink($new_query->post->ID);
                ?>
" title="<?php 
                echo $new_query->post->post_title;
                ?>
"><?php 
                echo $new_query->post->post_title;
                ?>
</a></dd>
				</dl>
				</div>
				</li> 
			<?php 
            }
            echo '</ul>';
        }
        echo $after_widget;
    }
コード例 #5
0
    $this->excerpt('280', '...');
    ?>
</p> 
                  <?php 
    if (get_post_img($this->cid) != null) {
        ?>

                  <div class="cards-media-container js-media-container">
                   <div class="cards-base cards-multimedia" data-element-context="platform_photo_card"> 
                    <a class="media media-thumbnail twitter-timeline-link media-forward is-preview " href="<?php 
        $this->permalink();
        ?>
"> 
                     <div class=" is-preview"> 
                      <img src="<?php 
        echo get_post_img($this->cid);
        ?>
" width="100%" alt="嵌入图像的永久链接" style="margin-top: -43px;" />
                     </div> </a> 
                    <div class="cards-content"> 
                     <div class="byline"> 
                     </div> 
                    </div> 
                   </div> 
                  </div> 
              <?php 
    }
    ?>

                  <div class="stream-item-footer">