• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Warmarks - WordPress Development

WordPress Custom Themes & Plugins

  • Home
  • Our Services
    • Website Development
    • Website Maintenance & Updates
    • Web Consultancy
    • WarMarks Web Tech Services
    • WordPress Services
    • Get a Quote
  • About
  • Testimonials
  • Blog
  • Contact us

wmAdmin15 / December 29, 2008

Show Hits At Frontpage & Category Pages

Note: Until second version of Module Hits AnyWhere is ready, I ask you to use the following guide to show hits at Category as well as Front Pages. As Hits AnyWhere Module shows hits at individual pages only to make your sit show hits at main website page and other pages following guide will help you:

Show Hits at Category Pages with Each Item:

You want to show the hits for every article in category page too?

You need to add the following code in your category page:

<@?php echo “Total Hits: “.$this->item->hits; ?>
(Remove @ from the start of this code.)
You can change the “Total Hits: ” with anything you want…

Ideally your joomla template should have html override folder…
i.e. you need to open this blog_item.php file, and add the above
code where you want to display the hits.

your joomla template > html > com_content > category > blog_item.php

This will work perfectly for you I am sure as we do this daily πŸ™‚
If you do not know how to edit template or your current tempalte dont
have the html override folder, let us know, and one of our coder will do
implement this for you.

Show Hits at Frontpage (Main page) of Your Joomla Site:

Just add the above code in the frontpage item i.e.

<@?php echo “Total Hits: “.$this->item->hits; ?>

(Remove @ from the start of this code.)
into the following file:
joomla template > html > com_content > frontpage > default_item.php

(Add this in the above file at the position where you want to show the hits)

But to make this code work you need to add one more little code at joomla page i.e.

Open components/com_content/models/frontpage.php
Search for this line at about 128th line:

$query = ‘ SELECT a.id, a.title, a.title_alias, a.introtext, a.fulltext……… big line πŸ™‚

you need to add this code (a.hits,) at the end before the “‘”
i.e.
a.attribs, a.urls, a.metakey, a.metadesc, a.access,

becomes :
a.attribs, a.urls, a.metakey, a.metadesc, a.access, a.hits,

This will make the code in template (you add at above heading) to work fine.

Refresh your site and see the hit counts it would work fine now.

Regards,

Mohsin Rasool

PS. If you want any customization, or this does not work in your situation. You can submit a support ticket at our desk and let one of our expert coder do this for you. Good Luck

Filed Under: Blog, Website Development

Primary Sidebar

Get a Free Quote

Best Customer Support Guaranteed

One Thing I would like to express is that Mohsin has a very professional attitude towards his customers. I encoutered a problem in downloading the report and he solved it immediately! ~Posted in Public forum by Mentor1970

Recent Posts

  • Four Must Have WordPress Plugins For Your Website To Make It Succeed Online
  • WordPress Security Risk Strategy for Your Internet Business Success
  • Why WordPress is Our Preferred CMS
  • Uploading Files Fast Quick Tip
  • Fire the Complex, Go for Simple

Footer

Contact Us

Office Address:

309-A, 3rd floor Regus,
The Enterprise Building,
1.5KM Multan Road Lahore

Contact form

About Us

We’re a website development & maintenance team who have a passion for web & internet technologies...

Read More

FOLLOW US

  • Facebook
  • LinkedIn

COPYRIGHT © 2021 · WarMarks