当前位置: 首页>>代码示例>>PHP>>正文


PHP getPostViews函数代码示例

本文整理汇总了PHP中getPostViews函数的典型用法代码示例。如果您正苦于以下问题:PHP getPostViews函数的具体用法?PHP getPostViews怎么用?PHP getPostViews使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getPostViews函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post_loop_views

function post_loop_views($postID)
{
    $count = getPostViews($postID);
    echo " • " . $count . "浏览";
}
开发者ID:ericzuobin,项目名称:luandun,代码行数:5,代码来源:functions.php

示例2: setPostViews

<?php

$ajaxVal = $_GET['ajax'];
if ($ajaxVal == "getPostViews") {
    setPostViews($_GET['postID']);
    echo getPostViews($_GET['postID']);
}
开发者ID:sdgdsffdsfff,项目名称:shipin,代码行数:7,代码来源:fo_ajax.php

示例3: the_permalink

    ?>


<li id="<?php 
    echo $post->ID;
    ?>
">

  <a href="<?php 
    echo the_permalink();
    ?>
" title="Enlace Permanente a <?php 
    echo the_title();
    ?>
 (<?php 
    echo getPostViews($post->ID);
    ?>
 visitas)">
          <div class="cont_text">
            <h4>
              <?php 
    $the_title = get_the_title();
    if (mb_strlen($the_title, 'utf8') > 75) {
        $last_space = strrpos(substr($the_title, 0, 75), ' ');
        // find the last space within 35 characters
        $the_title = substr($the_title, 0, $last_space) . '...';
    }
    echo $the_title;
    ?>
            </h4>
            <span class='duration_rand'><strong><?php 
开发者ID:agileontheweb,项目名称:xvp,代码行数:31,代码来源:_sidebar_tab.php

示例4: get_header

<?php

get_header();
$post_id = get_the_ID();
setPostViews($post_id);
$post_view = getPostViews($post_id);
?>
<div id="core_padding">
    <div id="core_padding_inner">
	<div class=" container widecontainer core_section_top_container">
		<div class="row core_section_top_row wlt_main_2colsleft">
 <div id="core_inner_wrap" class="clearfix">   

<article class="col-md-12 col-sm-12" id="core_middle_column"><div class="core_middle_wrap"><div id="core_ajax_callback"></div>	
<a name="toplisting"></a>
<a name="toplisting"></a>
<div class="row" style="margin-top:10px;">
    <div class="col-md-6">
    <h1 style="margin-top:0px;"><a href="<?php 
echo get_the_permalink();
?>
"><span><?php 
echo get_the_title();
?>
</span></a></h1> 
      </div>
<div  class="col-md-6 pull-left"  >
  <span id='timeleft_30971449416771686923'></span>
  <?php 
$cudate = get_post_meta($post_id, "expire_time", true);
$next_date = strtotime($cudate);
开发者ID:vishalmaniya,项目名称:auctoin,代码行数:31,代码来源:single-auction.php

示例5: widget


//.........这里部分代码省略.........
	<?php 
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>

	<div class="tabpost">
        <div class="featuredimagewidget thumbnailarea">
            <?php 
                if (has_post_thumbnail()) {
                    // check if the post has a Post Thumbnail assigned to it.
                    ?>
                <a class="thumblink" href="<?php 
                    the_permalink();
                    ?>
">
                    <?php 
                    the_post_thumbnail('tinyfeatured');
                    ?>
                </a>
            <?php 
                }
                ?>
        </div>

		<p><strong><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></strong></p>
		<p class="views"><?php 
                echo getPostViews(get_the_ID());
                ?>
</p>
		<div class="clear"></div>
	</div>

	<?php 
            }
        }
        wp_reset_query();
        ?>

	</li>

	<!-- Second Tab 
	================================================-->
	<li id="tab2">

	<?php 
        query_posts('ignore_sticky_posts=1&posts_per_page=' . $numposts);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>

	<div class="tabpost">
		
        <div class="featuredimagewidget thumbnailarea">
            <?php 
                if (has_post_thumbnail()) {
                    // check if the post has a Post Thumbnail assigned to it.
                    ?>
                <a class="thumblink" href="<?php 
开发者ID:aiandrade,项目名称:locallandr,代码行数:67,代码来源:widget-tab.php

示例6: getPostLikeLink

                </div>
                <div class="entry-top-meta">
                    <div class="like-button entry-top-meta-el">
                        <?php 
echo getPostLikeLink($post_id);
?>
                    </div>
                    <div class="comments-count entry-top-meta-el">
                        <i class="fa fa-comment-o"></i><span class="comments-count-num"> <?php 
comments_number('0', '1', '%');
?>
</span>
                    </div>
                    <div class="views-count entry-top-meta-el">
                        <i class="fa fa-eye"></i><span class="views-count-num"> <?php 
echo getPostViews($post_id);
?>
</span>
                    </div>

                </div>
            </div>

            <div class="entry-content">
                <?php 
the_content();
?>
                <?php 
wp_link_pages(array('before' => '<div class="page-links">' . esc_html__('Pages:', 'opengamer_theme'), 'after' => '</div>'));
?>
开发者ID:Chudylo,项目名称:opengamer_theme,代码行数:30,代码来源:content-news-side.php

示例7: the_view

function the_view()
{
    echo getPostViews(get_the_ID());
    if (is_single()) {
        setPostViews(get_the_ID());
    }
}
开发者ID:Nsking-xs,项目名称:rccoder,代码行数:7,代码来源:functions.php

示例8: get_page_list

function get_page_list()
{
    $cat = $_GET['cat'];
    $page = $_GET['page'];
    $posts_per_page = $_GET['posts_per_page'];
    if (!is_null($cat) && $cat != 0 && !is_null($page)) {
        $args = array("category__in" => array($cat), "paged" => $page, "posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc');
    } else {
        if (!is_null($cat) && $cat != 0 && is_null($page)) {
            $args = array("category__in" => array($cat), "posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc');
        } else {
            if ((is_null($cat) || $cat == 0) && !is_null($page)) {
                $args = array("paged" => $page, "posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc');
            } else {
                $args = array("posts_per_page" => $posts_per_page, "post_status" => "publish", 'post_type' => 'post', 'orderby' => 'post_date', 'order' => 'desc');
            }
        }
    }
    if (!is_null($cat)) {
        $posts = get_posts('post_status=publish&numberposts=-1&category=' . $cat);
        $count_total = count($posts);
    } else {
        $cat_case = get_category_by_slug('case');
        $cat_interview = get_category_by_slug('interview');
        $cat_personnel = get_category_by_slug('personnel');
        $cat_special = get_category_by_slug('special-column');
        $cat_news = get_category_by_slug('news');
        $posts = get_posts('post_status=publish&numberposts=-1&category=' . $cat_case . ',' . $cat_interview . ',' . $cat_personnel . ',' . $cat_special . ',' . $cat_news);
        $count_total = count($posts);
    }
    $the_query = new WP_Query($args);
    $resultData = new resultData();
    $resultList = array();
    $resultData->count_total = $count_total;
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $post = new postData();
        $post->title_plain = get_the_title();
        $post->url = get_permalink();
        $post->thumbnail = get_template_directory_uri() . "/timthumb.php?src=" . post_thumbnail_src() . "&h=168&w=224&zc=1";
        $post->excerpt = get_the_excerpt();
        $post->date = get_the_date('20y-m-d');
        $post->author_name = get_author_name();
        $post->views = getPostViews(get_the_ID());
        $the_post_category = get_the_category(get_the_ID());
        $post->category_name = $the_post_category[0]->cat_name;
        $the_post_category = get_the_category(get_the_ID());
        $catSlug = $the_post_category[0]->slug;
        $post->category_slug = $catSlug;
        $resultList[] = $post;
    }
    $resultData->posts = $resultList;
    header("Content-type: application/json");
    echo json_encode($resultData);
    wp_reset_query();
    die;
}
开发者ID:wangshijun101,项目名称:morketing.cn,代码行数:57,代码来源:functions.php

示例9: post_meta

function post_meta($disqus_shortname, $author, $date, $comments, $views, $category)
{
    $out = '';
    if ($author == 'view') {
        $out .= '<div><span>' . __('By', 'corporative') . '</span> ' . get_the_author_link() . '</div>';
    }
    if ($date == 'view') {
        $out .= '<div><span>' . __('In', 'corporative') . '</span> ' . get_the_time('F j, Y') . '</div>';
    }
    if ($category == 'view') {
        $out .= '<div><span>' . __('On', 'corporative') . '</span> ' . get_the_category_list(', ') . '</div>';
    }
    if ($comments == 'view') {
        $out .= '<div>' . comments_count($disqus_shortname) . '</div>';
    }
    if ($views == 'view') {
        $out .= '<div>' . getPostViews(get_the_ID()) . '</div>';
    }
    return $out;
}
开发者ID:devmoonshine,项目名称:development,代码行数:20,代码来源:content.php

示例10: ct_get_post_meta

    function ct_get_post_meta($ct_postid, $ct_comments, $ct_views, $ct_likes)
    {
        global $post;
        ?>

		<?php 
        if ($ct_comments == 1) {
            ?>
			<?php 
            if (comments_open()) {
                ?>
			<span class="meta-comments">
				<i class="icon-comment"></i>
				<?php 
                comments_popup_link(__('0', 'color-theme-framework'), __('1', 'color-theme-framework'), __('%', 'color-theme-framework'));
                ?>
			</span><!-- .meta-comments -->
			<?php 
            }
            ?>
		<?php 
        }
        ?>


		<?php 
        if ($ct_views == 1) {
            ?>
		<span class="meta-views" title="<?php 
            _e('Views', 'color-theme-framework');
            ?>
">
			<i class="icon-eye-open"></i>
			<?php 
            echo getPostViews($ct_postid);
            ?>
		</span><!-- .meta-views -->
		<?php 
        }
        ?>

		<?php 
        if ($ct_likes == 1) {
            ?>
		<span class="meta-likes" title="<?php 
            _e('Likes', 'color-theme-framework');
            ?>
">
			<?php 
            getPostLikeLink($ct_postid);
            ?>
		</span><!-- .meta-likes -->
		<?php 
        }
        ?>
		

		<?php 
        $post_type = get_post_meta($post->ID, 'ct_mb_post_type', true);
        if ($post_type == 'review_post') {
            ct_get_rating_stars();
        }
        if ($post_type == 'review_post_numeric') {
            ct_get_rating_numeric();
        }
        ?>

<?php 
    }
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:69,代码来源:functions.php

示例11: widget

    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        if ($instance['title'] != "") {
            echo $before_title . $instance['title'] . $after_title;
        } else {
            echo $before_title . "热门文章" . $after_title;
        }
        echo "<ul>";
        if ($instance['Num'] != "") {
            $popular = new WP_Query('orderby=comment_count&showposts=' . $instance['Num'] . '');
        } else {
            $popular = new WP_Query('orderby=comment_count&showposts=8');
        }
        while ($popular->have_posts()) {
            $popular->the_post();
            ?>
  <li class="article">
    <h2><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" target="_blank"><?php 
            the_title();
            ?>
</a></h2>
    <span>日期:<?php 
            the_time('Y-m-d');
            ?>
 评论:<?php 
            comments_number('0', '1', '%');
            ?>
 浏览:<?php 
            echo getPostViews(get_the_ID());
            ?>
</span>
  </li>
<?php 
        }
        echo "</ul>";
        echo $after_widget;
    }
开发者ID:wangshijun101,项目名称:morketing.cn,代码行数:45,代码来源:sidebar.php

示例12: getResizedImageTag

	<article class="post_item' . ($show_image == 0 ? ' no_thumb' : ' with_thumb') . ($post_number == 1 ? ' first' : '') . '">
';
if ($show_image) {
    $post_thumb = getResizedImageTag($post_id, 75, 75);
    if ($post_thumb) {
        $output .= '
			<div class="post_thumb">' . $post_thumb . '</div>
		';
    }
}
$output .= '
			<h5 class="post_title"><a href="' . $post_link . '">' . $post_title . '</a></h5>
';
if ($show_counters) {
    if ($show_counters == 'views') {
        $post_counters = getPostViews($post_id);
        $post_counters_icon = 'eye';
    } else {
        if ($show_counters == 'likes') {
            $post_counters = getPostLikes($post_id);
            $post_counters_icon = 'heart-1';
        } else {
            if ($show_counters == 'stars' || $show_counters == 'rating') {
                $post_counters = marksToDisplay(get_post_meta($post_id, $post_rating, true));
                $post_counters_icon = 'star-1';
            } else {
                $post_counters = get_comments_number($post_id);
                $post_counters_icon = 'comment-1';
            }
        }
    }
开发者ID:derwegas,项目名称:strubbelkinder,代码行数:31,代码来源:page-part-widgets-posts.php

示例13: print_post

function print_post($para_print_post, $cate_slug)
{
    $approveCom = wp_count_comments($para_print_post['id']);
    $output .= '<article class="newsCenter" id="post-' . $para_print_post['id'] . '" style="border-top: 2px solid ' . get_color($cate_slug) . ';">';
    $output .= '<div class="autNewsCt row">';
    $output .= '<div class="top-box-article"> ';
    $output .= '<span class="ctnAutCt col-md-10 col-sm-10 col-xs-9 col-lg-5">';
    $output .= '<h4>';
    $output .= '<a href="' . $para_print_post['link'] . '">' . $para_print_post['title'] . '</a>';
    $output .= '</h4>';
    $output .= '</span>';
    $output .= '<a class="date-post" href="' . $para_print_post['link'] . '">' . $para_print_post['date'] . '</a>';
    $output .= '<div class="icon-list-btn col-lg-4">';
    $output .= '<ul>';
    $output .= '<li>';
    $output .= '<span title="Cảm ơn"><i class="fa fa-heart"></i></span>';
    $output .= '<br/>';
    $output .= '<span class="value-btn">' . getPostLoves($para_print_post['id']) . '</span>';
    $output .= '</li>';
    $output .= '<li>';
    $output .= '<a title="Chia sẻ" class="btn-shareface" data-gtmname="chia-se" rel="nofollow" target="_blank" href="http://www.facebook.com/sharer.php?u=' . $para_print_post['link'] . '">';
    $output .= '<span><i class="fa fa-share-alt"></i></span>';
    $output .= '<br/>';
    $output .= '<span class="value-btn">' . get_post_shares($para_print_post['id']) . '</span>';
    $output .= '</a>';
    $output .= '</li>';
    $output .= '<li>';
    $output .= '<span title="Lượt xem" ><i class="fa fa-eye"></i></i></span>';
    $output .= '<br/>';
    $output .= '<span class="value-btn">' . getPostViews($para_print_post['id']) . '</span>';
    $output .= '</li>';
    $output .= '</ul>';
    $output .= '</div>';
    $output .= '</div>';
    $output .= '<div class="bottom-box-article">';
    $output .= '<a class="link-post-content" href="' . $para_print_post['link'] . '">';
    $output .= '<p>' . $para_print_post['except'] . '</p>';
    $output .= '</a>';
    $output .= '<div class="imgArtCt">';
    $output .= '<em>';
    $output .= '<a href="' . $para_print_post['link'] . '"><img src="' . $para_print_post['image_link'] . '" alt="' . $para_print_post['title'] . '"></a>';
    $output .= '</em>';
    $output .= '</div>';
    $output .= '</div>';
    $output .= '</div>';
    $output .= '</article>';
    echo $output;
}
开发者ID:RobertDuy,项目名称:demo_to_client,代码行数:48,代码来源:functions.php

示例14: accesspress_mag_home_posted_on_cb

 function accesspress_mag_home_posted_on_cb()
 {
     global $post;
     $show_post_views = of_get_option('show_post_views');
     $show_comment_count = of_get_option('show_comment_count');
     $show_post_date = of_get_option('post_show_date');
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     if ($show_post_date == 1) {
         $posted_on = sprintf(_x('%s', 'post date', 'accesspress-mag'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     } else {
         $posted_on = '';
     }
     echo '<span class="posted-on">' . $posted_on . '</span>';
     if ($show_comment_count == 1) {
         $post_comment_count = get_comments_number($post->ID);
         echo '<span class="comment_count"><i class="fa fa-comments"></i>' . esc_attr($post_comment_count) . '</span>';
     }
     if ($show_post_views == 1) {
         echo '<span class="apmag-post-views"><i class="fa fa-eye"></i>' . getPostViews(get_the_ID()) . '</span>';
     }
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:25,代码来源:accesspress-functions.php

示例15: widget

    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        //these are our widget options
        $title = $instance['title'];
        $count = $instance['count'];
        //get recent posts
        query_posts(array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'meta_key' => 'post_views_count', 'orderby' => 'meta_value_num', 'order' => 'DESC'));
        echo $before_widget;
        ?>
		<div class="clearfix">
			<div class="header_left">
				<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
			</div>
			<div class="header_right">
				<a href="#" id="most_viewed_prev" class="scrolling_list_control_left icon_small_arrow left_black"></a>
				<a href="#" id="most_viewed_next" class="scrolling_list_control_right icon_small_arrow right_black"></a>
			</div>
		</div>
		<div class="scrolling_list_wrapper">
			<ul class="scrolling_list most_viewed">
				<?php 
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
				<li class="icon_small_arrow right_black">
					<a href="<?php 
                the_permalink();
                ?>
" class="clearfix" title="<?php 
                the_title();
                ?>
">
						<span class="left">
							<?php 
                the_title();
                ?>
						</span>
						<span class="number">
							<?php 
                echo getPostViews(get_the_ID());
                ?>
						</span>
					</a>
					<abbr title="<?php 
                the_time('c');
                ?>
" class="timeago"><?php 
                the_time('c');
                ?>
</abbr>
				</li>
				<?php 
            }
        }
        wp_reset_query();
        ?>
			</ul>
		</div>
		<?php 
        echo $after_widget;
    }
开发者ID:unisexx,项目名称:drtooth,代码行数:68,代码来源:widget-scrolling-most-viewed.php


注:本文中的getPostViews函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。