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

UndefinedFunctionException in ThemeExtension.php line 50 #130

Open
spras opened this issue Jan 13, 2017 · 1 comment
Open

UndefinedFunctionException in ThemeExtension.php line 50 #130

spras opened this issue Jan 13, 2017 · 1 comment

Comments

@spras
Copy link

spras commented Jan 13, 2017

Sorry,

But i didn't manage to include WP header in my twig template as it might be donne by adding
{{ wp_get_header() }}

I have this error

UndefinedFunctionException in ThemeExtension.php line 50:
Attempted to call function "get_header" from the global namespace.
in ThemeExtension.php line 50
at ThemeExtension->getHeader() in 19f64244d06a93a0820abd0e8c807b7eb5e4818eaa365f1f228aebef615ba1ea.php line 50
at __TwigTemplate_d5e711f86a4a701ad023e0e021a5e9cd0e340f444811e1cc937ce5439aa98718->block_body(array('base_dir' => 

I think i missed something but i don't see what ?

wordpress/wp-includes/general_template.php where get_header() function is, is not loaded when i display my symfony page.

Do i need the wordpress eiko plugin ? if yes it's not clearly specified in documentation.

Thank's

@mickoz
Copy link

mickoz commented Mar 30, 2017

I am currently testing this Bundle and I hit the same problem and think I found the root cause. My best hypothesis is we copied this part of the EkinoWordPressBundle's Installation instruction into our app/config.yml:

ekino_wordpress:
    ...
    enable_wordpress_listener: false # If you want to disable the WordPress request listener
    ...

Comment/Remove the line (or set it to true which is the default value) and the bundle will load WordPress files, and the WordPress's function get_header() will then be available. If you set it to false, as said in the comment, it will skip loading WordPress into Symfony.

The way it is said, it was not as obvious to me too, and we may want to improve the documentation of this Bundle on a couple of details. If I end up using it and loving it, I am currently taking notes, and will see if I can help improve that part later on... as there is a lot of little quirks I'm hitting that does make it work "super easily" out of the box and have to figure out. My little experience with the Symfony full-stack framework and all its components might not help as I mostly used some components independently there and there in other projects in my past, and currently learning the full-stack. Still I wish the installation instructions would make this Bundle works easily and explain to the user the options a bit better, the good news with open source project is we can contribute to improve it!).

encreinformatique added a commit to websetstudio/EkinoWordpressBundle that referenced this issue Feb 12, 2020
The README.md has been modified after ekino#130 resolution. It has been difficult to find the solution until seeing this opened issue.

A Twig example has been added as well.
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

2 participants