Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__ Naming conflict with Wordpress #18

Open
yankeeinlondon opened this issue Oct 26, 2012 · 2 comments
Open

__ Naming conflict with Wordpress #18

yankeeinlondon opened this issue Oct 26, 2012 · 2 comments

Comments

@yankeeinlondon
Copy link

I'm trying to use underscore.php with a Wordpress installation and unfortunately Wordpress uses the __() function call as part of it's translation/localisation functions. Is there a simple and tested way to move underscore into a non-conflicting namespace?

@zealotrunner
Copy link

I implemented the noConflict method. I think it solves the problem.

zealotrunner/Underscore.php@c401d9d

@egorvinogradov
Copy link

egorvinogradov commented Aug 24, 2016

@zealotrunner How is noConflict supposed to be used?
Like this?

include_once "underscore.php";
$_ = Underscore::noConflict();
$_::whatever( ... );

If so, it doesn't quite solve the problem because the conflict occures right after I include the file 'underscore.php. Wordpress already has __ function, so I get an error:

Cannot redeclare __() (previously declared in /wp-includes/l10n.php:172)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants