Joke Collection Website - Blessing messages - How does wordpress add visitor information at the bottom of a web page?
How does wordpress add visitor information at the bottom of a web page?
* Total website visits/Total website visits today/Who is the visitor now?
* @ return[ type] [description]
*/
Function wb_site_count_user(){
$addnum = rand(5, 10); //The number of visitors increased by each visitor is 5- 10.
session_start()。
$date = date('ymd ',time());
If (! isset($_SESSION['wb_ '。 $ date])& amp; & amp! $_SESSION['wb_ '。 $date]){
$ count = get _ option(' site _ count ');
If (! $count ||! is_array($count)){
$newcount = array(
all ' = & gt8377670,
Date' = & gt$date,
Today' = & gt$addnum
);
update_option( 'site_count ',$ new count);
} Otherwise {
$newcount = array(
all ' = & gt($count['all']+$addnum),
Date' = & gt$date,
Today' = & gt($count['date'] == $date)? ($ count[' today ']+$ addnum):$ addnum
);
update_option( 'site_count ',$ new count);
}
$_SESSION['wb_ '。 $ date]= $ new count[' today '];
}
Return;
}
add_action('init ',' WB _ site _ count _ user ');
//Output access statistics
Function wb_echo_site_count(){
session_start()。
$ site count = get _ option(' site _ count ');
$date = date('ymd ',time());
Echo'<p> Total visits:
}
1. Add the above code to the back of the funciton.php function file in the wordpress theme root directory;
2. In the subject footer (footer.php), enter
- Related articles
- My wife was angry and coaxed her into sending humorous messages. You are the other half of my life.
- What does the bank interest rate adjustment mean?
- Friends circle sentence of keeping fit in midsummer
- How do foreigners apply for public rental housing in Xi?
- How to write the cover of the housewarming gift book
- Is Weihai Commercial Bank Reliable?
- How to send a blessing message to my mother-in-law
- MIUI 8 & ampMIUI 9 speed comparison
- How to replace the speakers of Samsung w20 17?
- Why doesn't Yixin invite friends to send text messages?