429 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+2 more
UXbarn says

Hi,

I would like to add those functions, for translation purpose, to the shortcode generator file which is in sub-folder of theme directory. It’s a general PHP file so once I added, the following error showed up:

Fatal error: Call to undefined function _e() in [file path].

Could you please advise how to achieve that?

Thanks in advance!

Paul

2071 posts
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Provided great feedback to improve the user experience on Envato Market
  • Interviewed on an Envato blog
+9 more
revaxarts says

You have to load WordPress

if ( !defined('ABSPATH') ) {
    /** Load WordPress Bootstrap */
    require_once('../../../wp-load.php');
}

You may have to change the path

429 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+2 more
UXbarn says

That perfectly works! Thank you @revaxarts. :)

by
by
by
by
by
by