本文整理汇总了PHP中setPostViews函数的典型用法代码示例。如果您正苦于以下问题:PHP setPostViews函数的具体用法?PHP setPostViews怎么用?PHP setPostViews使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setPostViews函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_view
/**
* call response ajax
*/
function update_view()
{
$action = $_POST['action'];
$id = $_POST['id'];
switch ($action) {
case 'update_view':
setPostViews($id, 'view-news');
break;
}
exit;
}
示例2: get_template_part
<div class="row top">
<div class="small-12 medium-8 columns" role="main">
<?php
//if( is_singular( array('ercs','whitepapers','webinars','special-reports') )) {
get_template_part('parts/flags');
?>
<?php
do_action('foundationpress_before_content');
?>
<?php
while (have_posts()) {
the_post();
setPostViews(get_the_ID());
?>
<?php
$astused = get_post_meta($id, '_wp_esmad_template', true);
$oldtemplate = get_post_meta($id, '_wp_post_template', true);
if (!$oldtemplate == 'default' and strlen($oldtemplate > 4)) {
echo '<!-- old template' . $oldtemplate . ' -->';
//using old template
//require_once( 'library/boxes.php' );
include 'single-coa.php';
} else {
?>
<article <?php
post_class();
示例3: get_header
<?php
/*
Single Post Template: Review
*/
/**
* The template for displaying review single posts.
*
* @package opengamer_theme
*/
get_header();
$post_id = $post->ID;
setPostViews($post_id);
?>
<style>
#masthead {
background: rgb(52, 168, 83);
}
.menu-item a {
color: #fff;
border-bottom: solid 2px rgb(52, 168, 83);
}
.menu-item a:hover {
border-bottom: solid 2px #fff;
}
</style>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
示例4: setPostViews
<?php
$ajaxVal = $_GET['ajax'];
if ($ajaxVal == "getPostViews") {
setPostViews($_GET['postID']);
echo getPostViews($_GET['postID']);
}
示例5: countShits
function countShits()
{
$corazones = $_GET['corazones'];
setPostViews(4, $corazones);
die;
}
示例6: the_view
function the_view()
{
echo getPostViews(get_the_ID());
if (is_single()) {
setPostViews(get_the_ID());
}
}
示例7: themerex_callback_post_counter
function themerex_callback_post_counter()
{
global $_REQUEST;
if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) {
die;
}
$response = array('error' => '');
$id = (int) $_REQUEST['post_id'];
if (isset($_REQUEST['likes'])) {
$counter = max(0, (int) $_REQUEST['likes']);
setPostLikes($id, $counter);
} else {
if (isset($_REQUEST['views'])) {
$counter = max(0, (int) $_REQUEST['views']);
setPostViews($id, $counter);
}
}
echo json_encode($response);
die;
}
示例8: while
</div>
<div class="dt-sc-margin30"></div>
<div class="container">
<!-- Primary Starts -->
<section id="primary" class="content-full-width invt_det">
<?php
while (have_posts()) {
the_post();
$timezone = +5.5;
$date = gmdate("F d, Y H:i:s", time() + 3600 * ($timezone + date("I")));
setPostViews(get_the_ID(), $date);
?>
<input type="hidden" name="showninterest" id="showninterest" value="0" />
<div class="column dt-sc-one-fourth first" >
<div class="id_logo">
<div class="portfolio-thumb">
<?php
if (has_post_thumbnail()) {
// $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ) );
the_post_thumbnail();
} else {
$img = wp_get_attachment_image_src(693);
echo "<img src='" . $img[0] . "' />";
}
示例9: single_views
function single_views($postID)
{
$count = setPostViews($postID);
echo '↔' . $count . '次浏览';
}
示例10: wp_get_attachment_url
if (has_post_thumbnail()) {
?>
<div class="container-fluid article-hero-image">
<?php
$postFeatured = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
?>
<img src="<?php
echo $postFeatured;
?>
" class="img-responsive">
</div>
<?php
}
// set post views
$postId = get_the_ID();
setPostViews($postId);
?>
<div class="container-fluid inner-page-content">
<div class="container">
<div class="row basic-page">
<div class="col-md-9">
<article class="main-article">
<h1><?php
the_title();
?>
</h1>
<div class="article-meta pull-left">
<div class="meta-title">SHARE</div>
<div class="social-buttons small">
<ul class="no-bullets inline">
示例11: get_header
get_header('soms');
?>
<div class="category-news-block auto rek" style=" background-image: none !important; float:right !important; width:670px; margin-top:0px !important;">
<?php
while ( have_posts() ) : the_post(); //стандартная итерация по массиву
?>
<div style="background-color:#EEE; padding:20px;">
<h1 style="font-family:bandera_proregular; font-size:50px; border-bottom:0 !important; margin-bottom:0 !important;">
<?php the_title(); ?>
</h1>
<h1 style="font-family:Verdana, Geneva, sans-serif; border-bottom: 0 !important; font-size:25px; margin:0; padding:0;">
<span style="font-size:10px; color:#333;"><?php echo get_date_formatted(get_the_date('d.m.Y.H.i')); ?></span> <span style="font-size:10px; color:#333;"> Коментариев: <?php comments_number('0', '1', '%'); ?> Просмотров: <?php setPostViews(get_the_ID()); ?><?php echo getPostViews(get_the_ID()); ?></span>
</h1>
</div>
<div style="overflow:hidden;" class="single-som">
<?php the_content(); ?>
</div>
<br>
<script type="text/javascript">(function() {
if (window.pluso)if (typeof window.pluso.start == "function") return;
if (window.ifpluso==undefined) { window.ifpluso = 1;
var d = document, s = d.createElement('script'), g = 'getElementsByTagName';
s.type = 'text/javascript'; s.charset='UTF-8'; s.async = true;
示例12: get_header
<?php
/*
* Author: KhangLe
*
*/
get_header();
setPostViews($post->ID, 'view-news');
?>
<div class="container news margin-top-xl margin-bottom-xl">
<div class="row">
<div class="col-xs-12 col-md-2">
<?php
get_sidebar('news-left');
?>
</div>
<div class="col-xs-12 col-md-7">
<article class="news-detail">
<h2><span><?php
echo $post->post_title;
?>
</span></h2>
<p><?php
echo $post->post_content;
?>
</p>
</article>
</div>
<div class="col-xs-12 col-md-3">
<?php