How to make __() and _e() work in any PHP file?
-
I’d like to have wordpress to do I18N for my javascript. My plan is to have javascript code in php file. For example, one sample.js.php file as below:
function foo() { alert(<?php _e('do something'); ?>); }
The sample.js.php file is referred as javascript.
<script type='text/javascript'>url-to-myplugin/sample.js.php</script>
However, it seems __() and _e() does’t work as they are not defined.
How to make the _e() and __() work in my case?Thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to make __() and _e() work in any PHP file?’ is closed to new replies.