Skip to main content

Questions tagged [count]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers

Conditional - Apply After Every Third Loop

The following is messy and obviously not scalable. There must be a way in twig to target a common difference of 3 right? {% if loop.first or loop.index == 4 or loop.index == 7 or loop.index == 10 %} ...
Jason McKinney's user avatar
0 votes
0 answers

Structuring externally scraped content

I scrape content from an external website using JSON API with the FeedMe plugin. Content is saved as entries with plain text and redactor-type Fields. How can I structure this content so that I can ...
Jay's user avatar
  • 11
1 vote
1 answer

Struggling to get Entry index number so I can output "X of Total Entries"

I have a channel which has multiple entries in, I'm trying to output the current entry number, for example "1 out of 20 posts" Currently this is what I am working with: {% set total = craft.entries()...
George Rowson's user avatar
1 vote
1 answer

Count entries with condition

I would like to count comments that belong to a certain entry (product). I have this so far: {% set comments = craft.entries().section('productcomments').all() %} {% set counter = 0 %} {% for ...
TomS's user avatar
  • 213
1 vote
1 answer

How to count ad impressions

We're adding advertising to our Craft site. The ads come from our business members and are displayed randomly with article pages, based on tags and categories. All that is working fine. The question ...
Mosswalker's user avatar
2 votes
1 answer

Get count of new entries since last visit

I'm relatively new to craft, but thanks to this board I am making great progress :-) But here is my first question, which is not answered in here: I would like to get the count of entries of a ...
Michal Mladekson's user avatar
1 vote
1 answer

Entry Count plugin performance / template optimisation

I'm using Ben Croker's Entry Count plugin in my News channel but have noticed a huge performance hit, I know its probably down to how I am loading the entries in to my template so I am looking for ...
Mark's user avatar
  • 741
1 vote
1 answer

loop.index is not returning correct number inside nested loop with inline if conditional

I'm getting incorrect loop.index results with the following code. It returns "1" for each entry returned. Is there a different way this needs to be written? {% for order in orders %} {% for ...
Anna_MediaGirl's user avatar
1 vote
1 answer

Count table field values in certain section

I would like to know, how many values are saved in the table field called "artikelnummer" with the field name "artikel". The section is called "bikes". I tried: {% set entries = craft.entries.section(...
TomS's user avatar
  • 213
1 vote
1 answer

How to display number of entries for a tag and not display if no entries?

I want to be able to display the number of entries that have a tag. Like: Fruit (9) Vegetables (4) I also want to avoid displaying any tags without any related entries. My code right now looks like ...
DevServe's user avatar
  • 303
2 votes
1 answer

Entry Count plugin

I'm trying to get the most popular entries of my site in a certain time period, for example 24h, based on the amount of views (clicks) it gets. I'm using the entry count plugin to do the counting but ...
Jan's user avatar
  • 363
3 votes
1 answer

How to add a unique number for each reiteration and render it multiple times?

I am working on a testimonial slider and each slide is wrapped in an <li> tag. The JS looks for a similar id number, one for each layer of the slide, in this case I need to change the 1 in the ...
Nutmeg's user avatar
  • 598
1 vote
1 answer

Get the current structure entry's order

How can I get the number of a current entry in a structure? In other words, I'm getting the total number of entries like so: {% set count = craft.entries.section('projects').total() %} <h1>{{ ...
Jesse Winton's user avatar
1 vote
2 answers

Count users, not enough memory error

Hi I have like 2000 users in my system. I would like to get a count of the active ones, so I did it like this: {{'member').count()}} but this returns the count with the limit of ...
Alex's user avatar
  • 143
2 votes
2 answers

Reverse count with paginated entries?

I have this loop {% paginate craft.entries.section('sermons').limit('10') as pageInfo, entries %} {% for sermon in entries %} ... {{ loop.revindex }} ... {% ...
Steven Grant's user avatar
  • 1,855