ដាក់​បង្ហាញ​ចំនួន​ស្ថិតិ​អ្នក​ចូល​ទស្សនា​ប្លុក​


ប្លុក​ហ្គ័រ​មាន​ Widget មួយ​ដែល​មាន​ឈ្មោះ​ថា​ Stats ដែល​អនុញ្ញាត​ឲ្យ​អ្នក​អាច​ដាក់​បង្ហាញ​នូវ​ចំនួន​ស្ថិតិ​អ្នក​ចូល​ទស្សនា​ប្លុក​របស់​អ្នក​បាន​។ នៅ​ក្នុង​អត្ថបទ​មួយ​នេះ​ខ្ញុំ​នឹង​បង្ហាញ​អ្នក​ទាំង​អស់​គ្នា​ពី​របៀប​ក្នុង​ការ​កែ​ប្រែ​នូវ​ Stats Widget នោះ​ឲ្យ​កាន់​តែ​ស្រស់​ស្អាត​រួម​ជា​មួយ​នឹង​ការ​ប្រើ​ប្រាស់​រូប​ Icon របស់​ Font Awesome ទៀត​ផង​​ មិន​តែ​ប៉ុណ្ណោះ​ Widget នេះ​មាន​បង្ហាញ​នូវ​ចំនួន​អត្ថបទ​សរុប និង​ចំនួន​បញ្ចេញ​មតិ​សរុប​ដែល​មាន​នៅ​ក្នុង​ប្លុក​របស់​អ្នក​ផង​ដែរ​។

១-សូម​ចូល​ទៅ​កាន់​គណនី​ប្លុក​របស់​អ្នក​
២-ចូល​ទៅ​កាន់ Theme បន្ទាប់​មក Edit HTML
៣-ចម្លង​កូដ​ខាង​ក្រោម​ដាក់​ពី​ខាង​ក្រោម <head>
ចំណាំ​៖ ប្រ​សិន​បើ​អ្នក​មាន​កូដ Icon Font Awesome Version 5 រួច​រាល់​នៅ​ក្នុង​ស្បែក​ប្លុក​សូម​រំ​លង​ចំណុច​នេះ
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.css" integrity="sha256-piqEf7Ap7CMps8krDQsSOTZgF+MU/0MPyPW2enj5I40=" crossorigin="anonymous" />
៤-ចម្លង​កូដ​ខាង​ក្រោម​ដាក់​ពី​ខាង​លើ ]]></b:skin>
a#Stats1_totalCount{float:right;background-color:rgba(155,155,155,0.02);color:#2196F3;padding:0 10px;margin:4px 0;line-height:22px;border:1px solid #eee}
.count_text{width:100%;display:inline-block;font-size:15px;height:35px;line-height:35px}
.count_text.view2:before, .count_text.post2:before, .count_text.comment2:before{font-family:"Font Awesome 5 Free";font-weight:600;margin:0 8px 0 0}
.count_text.view2:before{content:"\f080"}
.count_text.post2:before{content:"\f303"}
.count_text.comment2:before{content:"\f27a";font-weight:400}
.count_num{float:right;display:inline-block;font-size:15px;background-color:rgba(155,155,155,0.02);color:#2196F3;text-align:center;padding:0 15px;margin:4px 0;line-height:22px;border:1px solid #eee}
៥-ចម្លង​កូដ​ខាង​ក្រោម​ដាក់​ចូល​ចន្លោះ​ <b:section>...</b:section> នៃ​ Sidebar (សូម​មើល​រូប​)
<b:widget id='Stats1' locked='false' title='ចំនួនស្ថិតិសរុបជាប្រចាំ' type='Stats' version='2' visible='true'> <b:widget-settings> <b:widget-setting name='showGraphicalCounter'>false</b:widget-setting> <b:widget-setting name='showAnimatedCounter'>false</b:widget-setting> <b:widget-setting name='showSparkline'>false</b:widget-setting> <b:widget-setting name='sparklineStyle'>BLACK_TRANSPARENT</b:widget-setting> <b:widget-setting name='timeRange'>ALL_TIME</b:widget-setting> </b:widget-settings> <b:includable id='main'> <b:include name='widget-title'/> <b:include name='content'/> </b:includable> <b:includable id='content'> <div class='widget-content'> <!-- Content is going to be visible when data will be fetched from server. --> <div expr:id='data:widget.instanceId + &quot;_content&quot;' style='display: none;'> <!-- Counter and image will be injected later via AJAX call. --> <b:if cond='data:showSparkline'> <img alt='Sparkline' expr:id='data:widget.instanceId + &quot;_sparkline&quot;' height='30' width='75'/> </b:if> <span expr:class='&quot;count_text view2 &quot; + (data:showGraphicalCounter ? &quot;graph-counter-wrapper&quot; : &quot;&quot;)'> TOTAL PAGEVIEWS<a expr:id='data:widget.instanceId + &quot;_totalCount&quot;'/></span> <script type='text/javascript'> function postCount(json){ document.write(&quot;<span class='count_text post2'> TOTAL PUBLISHED POSTS &quot;); var count = json.feed.openSearch$totalResults.$t; document.write(&quot;<span class='count_num'>&quot; + count + &quot;</span>&quot;); document.write(&quot;</span>&quot;) } function numberOfComments(json){ document.write(&quot;<span class='count_text comment2'> TOTAL COMMENTS &quot;); var count = json.feed.openSearch$totalResults.$t; document.write(&quot;<span class='count_num'>&quot; + count + &quot;</span>&quot;); document.write(&quot;</span>&quot;) } </script> <script src='/feeds/posts/default?alt=json-in-script&amp;max-results=0&amp;callback=postCount' type='text/javascript'/> <script src='/feeds/comments/default?alt=json-in-script&amp;max-results=0&amp;callback=numberOfComments'/> </div> </div> </b:includable> </b:widget>
៦-ចុច​ពាក្យ Save Theme​៕

Post a Comment

Previous Post Next Post