سنحتاج إلى ملفين. واحد للنص والآخر لتخزين الزيارات. هنا لقطة من الدليل الخاص بي. المشاركة، حتى تحصل على الأشياء بسرعة.
Step 1: Create a file named
counter.php. Edit it with Notepad/Notepad ++
$handle = fopen("counter.txt", "r");
if(!$handle) {
echo "could not open the file";
} else {
$counter =(int )fread($handle,20);
fclose($handle);
$counter++;
echo"Number of visitors to this page so far: ". $counter . "" ;
$handle = fopen("counter.txt", "w" );
fwrite($handle,$counter);
fclose ($handle);
}Save the file and upload it to the directory.
تكبير الصورةمعاينة الأبعاد الأصلية.Step 2: Create another file named
counter.txt. Upload this file to the directory. You can put any number in this file it will echo as a log where you want to show the page hits.
Step 3: You see the
index.php file to that directory in the screenshot above that the folder where I am going to include the counter script. So we can see the “Number of visitors to that page.”
wprocket-728x98_Black
Visitor-Counter-to-Pricing-Table-Page
I wanted to add the visitor counter at the footer. So I wrote the below snippet under of all elements.
<div class="visitor-count"> <?php include "counter.php"; ?> </div>
How to Display Post Views in WordPress
https://rainastudio.com/add-visitor-counter-to-wordpress/https://wordpress.org/plugins/post-views-counter/#descriptionمصدر