简体   繁体   English

自定义帖子查看计数器WordPress

[英]Custom post view counter WordPress

I am making custom post view counter but it's not working. 我正在制作自定义后视图计数器,但是它不起作用。 I have made change on working post view code but not working. 我对工作后的视图代码进行了更改,但不起作用。

<?php echo $td_mod_single->get_views();?> this one is working post view counter. <?php echo $td_mod_single->get_views();?>这个正在工作的视图查看计数器。 I have changed it to like this <?php echo $count = rand(1,999); ?> 我将其更改为这样<?php echo $count = rand(1,999); ?> <?php echo $count = rand(1,999); ?> but it's not working. <?php echo $count = rand(1,999); ?>但它不起作用。

I have replaced this <?php echo $td_mod_single->get_views();?> to <?php echo $count = rand(1,999); ?> 我已经将此<?php echo $td_mod_single->get_views();?>替换为<?php echo $count = rand(1,999); ?> <?php echo $count = rand(1,999); ?>

Just do the rand, you don't need to count it.. 只要做兰特,就不用算了。

<?php echo rand(1,999); ?>

This will output a random number between 1 and 999 这将输出1到999之间的随机数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM