小编Tim*_*urr的帖子

WordPress将the_views中的视图作为变量发布

我正在使用WordPress插件WP-PostViews来显示帖子的视图数量。我正在使用此代码,它很好用:

<?php if(function_exists('the_views')) { the_views(); }?>
Run Code Online (Sandbox Code Playgroud)

我想做的是将一定数量的帖子视图用作变量,但是我无法使其正常工作。到目前为止,我已经尝试过:

<?php if(function_exists('the_views')) { $variable = the_views(); } ?>
Run Code Online (Sandbox Code Playgroud)

<?php if(function_exists('the_views')) { $variable = the_views(); } else { $var = 0; } ?>
Run Code Online (Sandbox Code Playgroud)

到目前为止没有成功。有人有建议吗?

php variables wordpress function

2
推荐指数
1
解决办法
1085
查看次数

标签 统计

function ×1

php ×1

variables ×1

wordpress ×1