How to Introduce "Busuanzi" to Count Visits in Typecho
Implementation Effect
- The count is not displayed until the visitor data is retrieved.
- The main site only shows the total site page views and the total number of visitors.
- The article section shows the total site page views, total article page views, and total number of visitors.
You can directly modify the footer.php code as follows:
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
</div><!-- end .row -->
</div>
</div><!-- end #body -->
<footer id="footer" role="contentinfo">
© <?php echo date('Y'); ?> <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title(); ?></a>
<?php _e('Powered by <a href="https://typecho.org">Typecho</a>'); ?><br>
<!-- 不蒜子脚本 -->
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<!-- 不蒜子标签 -->
<?php if($this->is('index')): ?>
<span id="busuanzi_container_site_pv" style='display:none'>
Total reads of this site <span id="busuanzi_value_site_pv"></span> times<br>
</span>
<span id="busuanzi_container_site_uv" style='display:none'>
Visitors of this site <span id="busuanzi_value_site_uv"></span> times<br>
</span>
<?php else: ?>
<span id="busuanzi_container_site_pv" style='display:none'>
Total reads of this site <span id="busuanzi_value_site_pv"></span> times<br>
</span>
<span id="busuanzi_container_page_pv" style='display:none'>
Total reads of this article <span id="busuanzi_value_page_pv"></span> times<br>
</span>
<span id="busuanzi_container_site_uv" style='display:none'>
Visitors of this site <span id="busuanzi_value_site_uv"></span> times<br>
</span>
<?php endif; ?>
</footer><!-- end #footer -->
<?php $this->footer(); ?>
</body>
</html>
Original link:http://enblog.fuyiran.link/Technology/7.html
Copyright: All posts on this blog, unless otherwise stated, are published using theCC BY-NC-SA 4.0 license agreement. Please indicate the source for reprinting Fu Speaking (enblog.fuyiran.link)