401 posts Keep Walking
  • Has been a member for 3-4 years
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Exclusive Author
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

2024 posts
  • Elite Author
  • Author had a Free File of the Month
  • Has been a member for 4-5 years
  • Austria
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Envato Studio (Microlancer) Beta Tester
+3 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

401 posts Keep Walking
  • Has been a member for 3-4 years
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Exclusive Author
UXbarn says

That perfectly works! Thank you @revaxarts. :)

by
by
by
by
by
by