Posted: December 12, 2013 at 3:48 am
|
Hi, So I want something like a counter that shows me the number of the avtive avents in this category. Is this possible maybe with a shortcode or something else? EE: v3.1.36.1.P Thanks |
|
Hi, There isn’t a shortcode for it, but it could be done with one or two lines of code. Edit the event_list.php file, around line 274 just after it says <pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>if ( $events) { Below that add <pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>echo count($events); This will simply add a number whihc corresponds with the number of events listed. You could dress it up a bit like <pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>echo "<p>Number of Events found: " . count($events) . "</p>"; |
|
Thanks for the answer. Sorry it´s not that what I´m searching for. Here is the link about my problem: I have listed images that should describe a random category. You get to the category when u klick on the image-link. Now I want a counter description which gives the users a feedback of that how much active events are in this category… |
|
|
|
Try: |
|
Thanks a lot. Even though it doesn`t work 🙁 |
|
Hi, Wrong functions.php, it would need to go into the Themes functions.php file, not the one in Event Espresso. |
|
🙂 ok, now I’m a step further! Hopefully one last thing: It shows me an incorrect number of active events. It shows 6 instead of 3. I’ve deleted all events in the trash, pending, inactive… and deleted cache – without success. Do u have any solution for this? |
|
For the category_id attribute in the shortcode, you’ll want to use the ‘Unique Category Identifier’ in the category editor. It should be the same as the one in the EVENT_ESPRESSO_CATEGORY shortcode that shows in the category’s row in the Manage Event Categories admin page. |
|
That’s the code that I used for it. I found out, that if I delete a event and then also deltete. In the trash, nothing changes in the number, that is shown. So there must be something wrong in the code or is there a way to delete events after the trash? |
|
When the event is deleted, it must not be updating the category rel table. I’ve updated the gist above to take that into consideration. |
|
That’s it, Thank you so much! 🙂 |
The support post ‘Counter of the number of the events in a category’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.