Advanced custom fields add functionality
-
Dear WordPress community,
I am using a WordPress plugin which is called “Advanced Custom fields” and I am very happy with its ease of use and functionalities.
What I am looking forward to achieve is to add a specific hook or functionality to one of my fields to open a popup field once clicked.
The code I have created and that I would like to run for the popup would be the following:
<script language="javascript" type="text/javascript"> function popup(url) { var width = 480; var height = 500; var left = (screen.width - width)/2; var top = (screen.height - height)/2; var params = 'width='+width+', height='+height; params += ', top='+top+', left='+left; params += ', directories=no'; params += ', location=no'; params += ', menubar=no'; params += ', resizable=no'; params += ', scrollbars=no'; params += ', status=no'; params += ', toolbar=no'; newwin=window.open(url,'windowname5', params); if (window.focus) {newwin.focus()} return false; } </script> <input type="text" name="field" id="field"onclick="javascript:popup('https://myurl', '200', '200', '510', '440');return false;">The code of my field looks as follows:
<div id="acf-custom_field" class="field field-text"><p class="label"><label for="fields[field_5007b7f298fd6]">Custom field</label></p><input type="text" value="" id="fields[field_5007b7f298fd6]" class="text" name="fields[field_5007b7f298fd6]"></div>Is there an easy way (for example by adding something in theme-functions) to add a on click event to this specific item?
Some expert advise would be highly appreciated.
Thank you very much,
Patrick
The topic ‘Advanced custom fields add functionality’ is closed to new replies.