492 posts Keep Walking
  • Has been part of the Envato Community for over 4 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,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

2261 posts
  • Had an item that became a weekly top seller
  • Became a Top 20 Author of the Month
  • Created a helpful tool/app using the Envato API
  • Created a helpful tool/app for Envato Market users
+15 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

492 posts Keep Walking
  • Has been part of the Envato Community for over 4 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,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