Menampilkan tulisan Artikel ini Telah Dibaca Berapa Kali di Bawah Postingan

Menampilkan Berapa kali artikel di baca.
Artikel Dibaca

Anda mungkin sering menemukan Artikel ini telah dibaca sebanyak xxx kali. Untuk DEMO, silahkan gulir ke bawah, lihat di akhir postingan. Hal ini lah yang akan saya jelaskan saat ini.

Pasang JavaScript

Seperti biasa, masuk ke Edit Template. Simpan script ini di atas </body>

<b:if cond='data:view.isPost and !data:view.isPreview and !data:view.isError'>
	<script type='text/javascript'>
		function pCount(response) {
			document.getElementById(&#39;count&#39;).innerText = response.value;
		}
	</script>
	<script async='async' expr:src='&quot;https://api.countapi.xyz/hit/&quot; + &quot;blog-&quot; + data:blog.blogId + &quot;/&quot; + &quot;post-&quot; + data:blog.postId + &quot;?callback=pCount&quot;'/>
</b:if> 

Menempatkan KOde HTML di bawah Postingan

Selanjutnya simpan kode ini di atas <data:post.body/>:

<div class='baca'>
   Artikel ini telsh dibaca sebanyak
     <span id='count'>
       0
     </span>
</div>

Apabila menemukan beberapa <data:post.body/> maka pilih yang terdapat di tag kondisional seperti ini

<b:if cond='data:view.isPost'>
  ....
  <data:post.body/>
  ....
</b:if>

atau Tag Kondisional versi lama

<b:if cond='data:blog.pageType == "item"'>
  ....
  <data:post.body/>
  ....
</b:if>

Penambahan CSS

Simpan kode ini di atas </style> atau ]]></b:skin>

.baca{font-family: font-size:13px;font-weight:normal;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;padding:7px 0}
#count{font-weight:bold}

Simpan Template.

Terima kasih Kang Ismet atas kodenya, dan diizinkan untuk repost

Source:
www.kang-ismet.com

3 komentar

  1. Blognya keren... jadi keinget Ardan FM stay cool and lovely. mantap lanjutkan
    1. makasih kang. hihi emang tiba tiba ke idean aja
  2. sayangnya blogger emg minim fitur karena tujuannya emg buat blogger, bukan website. jadi fokus posting² aja. tapi karena basicnya website ya tentu saja bisa diakalain pake source ekstenal. sayangnya blogspot sekedar mirip sosmed jadi nggak bisa host file dan perlu database luar. ribetnya karena gak bisa akses isi nya dan hanya singlenfile .xml

    ~amirulfaozi.com
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.