Home › Forums › General Issues › Views Counter Field › Reply To: Views Counter Field
I’ve looked for hours for a straightforward tutorial where I can accomplish something which on its face seems like it would be rather simple. Unfortunately, all the posts and info I’ve found have not quite been what I’m looking for and I’m failing miserably. I’ve seen many about update_field, etc, but the info is too general for my working knowledge (eg: https://www.advancedcustomfields.com/resources/update_field/). I’m hoping someone will be able to supply what I need to accomplish this [now frustrating] task.
Here is what I’m trying to do…
I have a custom post type named ‘brochures’ and a “File” custom field (‘bro-spec-pdf’) which I’m using to echo the [‘url’] for a PDF download in a loop file (code below; listing_brochures-loop.php).
I also have a second custom field (‘bro-spec-views’; currently a number field) I would like to use as a “Views” count so I know how many times that File[‘url’] field has been clicked for each post. I would like that count to increase 1 for each click.
I understand that admin-ajax has to be used somehow, but all that I’ve tried has not worked. It’s also not my strong area, so it’s possible I just have no idea what I’m doing for that aspect.
Can someone please lend a hand and provide what’s needed to get this done? Thank you in advance for any help you can provide.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.