WordPress displays commentator countries, browsers, operating systems, and locations

Step 1. Download the code package Step 2. Call the code Step 3. Add code to Comment-Tempeland.php Step 4. Custom Style Step 5. Verify Directory

Leisure time, browse others blog, always like to look at the comments of others’ articles, and unexpectedly discovered that the mouse stayed in a commentator’s comment area, there will be the country, operating system, browser, etc. where the commentator is located. May feel very interesting, always love to toss, how can I study it.

May use the WordPress’s Begin theme, the following tutorial is for the SEO construction site for the Begin theme, please please be able to apply if you have yourself, appropriate modification.

STEP 1. Download Code Pack

Extraction code: T37P

Code download

Unzip the code package is the show-useERAGENT folder, upload to the Begin Topics root directory

Step 2. Calling code

Add the following code to the Functions.php of the BEGIN topic root directory

Require get_template_directory (). ‘/Show-Userage/show-useragent.php’;

Step 3. Add code to Comment-Tempeland.php

Find the start-template.php of Begin / Inc Directory, find the following line of code (I am on the 45th line)

Add:

STEP 4. Custom Style

According to your preference, custom CSS style, add to begin subject options – custom style – custom style OR look – Custom – Additional CSS OR Appearance – Edit -Style.css

MAY style for your reference:

. WB-OS img {width: 14px; height: auto; vertical-align: -6%;} @ media screen and (min-width: 900px) {.comment-body: Hover. Flags {Display: inline; animation: fade-in; -Webkit-animation: fade-in 0.3s;}}

Step 5. Verification

The mouse stays in a comment area, which will display the criteria’s country, browser, operating system, and area. As shown below:

Haha, success ~~~

Is it very magical?