Extension, Fieldtype, Module

Developer
Supported

Popular - The Advanced View Counter for ExpressionEngine

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Notebleu

     

You must be logged in to post.

Custom channel fields inside the {exp:popular:most_popular} loop

General

mavrekh
mavrekh

I’m coding a module that returns the five most popular posts for the past thirty days. My channel entries have some important data in custom channel fields that I need to access in the module. When I code the loop as shown below, the custom fields work, but every time the module is loaded in a page all 5 entries get an additional count. Is there a better way to get the channel fields to work?

{exp:popular:most_popular channel_ids=“11” limit=“5” start_on=”<?php print strtotime( ‘-30 days’, time()); ?>” sort=“desc”}
  <li> 
{exp:channel:entries entry_id=”{entry_id}” dynamic=“off”}

...blah blah ...


      {/exp:channel:entries}
{exp:popular:most_popular

 

Notebleu
# 1
Developer
Notebleu

Hi mavrekh,

Try disabling the extension for that channel by going to Add-ons > Extensions > Popular (Settings) in the Control Panel and deselecting the channel in “Allowed Channel Id’s”.  Then add this tag wherever you want an entry to be counted: {exp:popular:track_view} the track_view tag can take either an entry_id or a url_title as a parameter.  More on that here: https://notebleu.com/software/popular.  That will ensure that your entry is never double counted by the extension.

Let me know if that helps resolve this for you.

mavrekh
# 2
mavrekh

Thank you for your quick response. This did the trick.

Thanks!