Support Forum

Custom Feeds – Based on hits and time

KE Kenn
Kenn
Member

Hi all,

I have been asked if I can create a feature to promote the customers most ‘popular’ topics.

If I can create an RSS feed I can then display this however they want.

Is there a way I can create a feed that sorts by hits within the last 30days?

eg.

Topic 1 – 12,000 hits – 3 days ago

Topic 2 – 10,000 hits – today

Topic 3 – 9,000 hits – 1 week ago

I obviously don’t want to include the hits or dates, just an example of the order I want to achieve.

Thanks as usual for any help.

Kenn

19 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Creating an RSS feed is possible of course but does require php coding and MySQL queries… We do have a ‘Hot Topics’ template tag that might come close to what you are looking for – al least worth a look at before doing that I would have thought:

http://codex.simple-press.com/codex/plugins/our-plugins/the-template-tags-plugin/template-tag-hot-topics/

KE Kenn
Kenn
Member

Hi thanks for the reply, I will take a look. I’m having issues again gaining access to the codex. You fixed it for me last time by resetting something?

“We’re sorry, but our records show that your subscription has expired or has been cancelled.
To re-gain access to the site you’ll need to re-subscribe.”

YS Yellow Swordfish
Yellow Swordfish
Member

Please try now.

We are actually right in the middle of a project to solve this problem once and for all!

KE Kenn
Kenn
Member

Looking through the codex, this looks like exactly what I need. Thanks

KE Kenn
Kenn
Member

I would like to add this to the page if possible as opposed to the template, is there any way to add filters with the shortcode?

eg. code/ ([)sp_hot_topics('showCount=0&showForum=0&textHotness=Rating&limit=2')(]) /code

YS Yellow Swordfish
Yellow Swordfish
Member

Well – I believe all of the attributes that are available for the template tag are also available for the shortcode (sp_hot_topics).

I am not that familiar with shortcodes myself but is that how you usually pass the attributes?

KE Kenn
Kenn
Member

Hello again,

I’m afraid attributes don’t seem to work like that with shortcodes. As I can’t put php code into widgets can you offer any advice how I would achieve hot topics with defined attributes in a widget?

YS Yellow Swordfish
Yellow Swordfish
Member

Really? I will need to test that… I can just never remember the syntax for using shortcodes. I thought is was spaces…

For expediency I would suggest you go grab a plugin named WP Exec PHP from the WP plugin repository, activate it, go to the WP admin options for it and turn on the option to use in widgets – and then use the template tag in the widget.

Bit I will investigate the short code usage.

KE Kenn
Kenn
Member

I’ve worked out how to add it where I want in the template if needed, I’ve read the codex but it doesn’t explain what the number is? How does the system generate the rating? It’s doesn’t appear to be hits? Is it hits divided by time or something?

KE Kenn
Kenn
Member

Thanks for your previous reply I hadn’t refreshed my screen. I was using the shortcode like this, was this wrong?

[sp_hot_topics (‘days=365’)]

YS Yellow Swordfish
Yellow Swordfish
Member

For the question ion Post #12 I am going to have to ask because I really do not know. So hopefully Mr Papa will dive in and tell you because he does know!

Not sure I understand question #13 though…?

KE Kenn
Kenn
Member

Sorry I was trying to paste the code but they don’t show up, do I put tags round a code to show you?