Code for zblog to count the number of articles published by the website in the last 24 hours

Exhibition of works zero five hundred and seventy-one

If the website is updated frequently and has a lot of content, the statistics of the website, such as the total number of articles, the total number of views, etc., will usually be displayed on the front page of the zblog website. In addition to these, the statistics of the number of updated articles in the last 24 hours are also frequently seen. How should the data of the number of articles published by zblog in the last 24 hours be used? Only two pieces of code are required.

 Code for zblog to count the number of articles published by the website in the last 24 hours

Put the following code into the theme's include.php file:

PHP
 function qiteen_postNum(){ global $zbp; $nowtime = time(); $settime = 1*24*60*60; $gettime = $nowtime-$settime; $db = $zbp->db->sql->get(); $sql = $db->select('zbp_post')->where(array(array('=','log_Status','0'),array('>','log_PostTime',$gettime)))->sql;     $array = $zbp->GetListType('Post', $sql); echo count($array);    }

Add code where you want to call (such as the footer.php file):

PHP
 {qiteen_postNum()}

Save the file, update the cache or recompile the theme in the background.

Note: The above code is only applicable to zblog php version 1.5 or above.

Related recommendations:

Message from netizens:

I would like to comment:

◎ Welcome to participate in the discussion. Please express your views and exchange your views here.
 Verification Code