1

Now I have a problem situation with Advanced Custom Field plugin in Wordpress.

Every posts with different information in Advanced Custom Field (ACF), for examples:

-post #1: los angeles

-post #2: texas

-post #3: california

Now, I want to create a custom page named 'Show Locations' template for showing that relevant information when use click on a certain link. How can I track a link that user click on and show relevant data for them.

I've tried:

<?php get_field('field_name', $post->ID); ?>    

But it didn't work.

Weafs.py
  • 22,731
  • 9
  • 56
  • 78
  • You create page for each location in the template 'Show Locations'? and you set the ACF in each page? – Shibi Nov 16 '14 at 01:46

1 Answers1

1

To record user interactivity you will need to use javascript and send the data back to the server. PHP is a server-side language so you cannot do it only by using PHP.

E.g

<div data-field-id="1" onClick="sendIdToServer(1)">Texas</div>

You will need to implement a JS method called 'sendIdToServer'

function sendIdToServer(id) {
   .. //Read JQuery docs for $.ajax or $.post
}
Zeeshan Abbas
  • 821
  • 6
  • 20