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

Wordpress not there yet, when code checks for wordpress #9

Closed
landwire opened this issue Dec 18, 2019 · 6 comments
Closed

Wordpress not there yet, when code checks for wordpress #9

landwire opened this issue Dec 18, 2019 · 6 comments

Comments

@landwire
Copy link

Hi there,
I followed your instructions, but somehow the autoloader seems to load the package too early and wordpress is not available yet. I have a "normal" roots.io bedrock setup. Is there something I have to change about the loading order or anything?

To test, I made your code into a plugin and then it works fine. But I would prefer to use the composer package.
Thanks for any help,
Sascha

@palmiak
Copy link
Owner

palmiak commented Dec 18, 2019

Hi, I also use it with bedrock. One question though - do you use it with theme composer or bedrock's composer?

I always add it to the theme's composer.

@landwire
Copy link
Author

Ah! That might be the problem. Added it to the bedrock composer! Will try it with the themes composer and give some feedback.
Thank you for the quick reply!

@landwire
Copy link
Author

My bad!

Works like a charm now and it clearly says in the documentation:
Run the following in your Timber-based theme directory:
composer require "palmiak/timber-acf-wp-blocks"

Thanks again for your help and the code!

@drzraf
Copy link

drzraf commented Jan 6, 2020

Since this plugin does not rely upon assets (that would not load from /vendor/ directory), it does not need to be a dependency of the theme? Any way this could work from Bedrock's autoload?

@palmiak
Copy link
Owner

palmiak commented Jan 7, 2020

Hi @drzraf

I will be creating a plugin version of this library (#12) so you'll be able to add this to Bedrock's main composer. As I'll automate the process I can also create an mu-plugin so it will always be active. I hope I'll do this during the upcoming two weeks.

@mortensassi
Copy link

mortensassi commented Apr 3, 2021

Hi @palmiak any news on this? I can't get this plugin to work with my bedrock installation.

I have installed and put the plugin in the mu-plugins folder which also gets displayed in the backend
However, in my Class i am making usage of some of your filters, like redefining the path:

public function twigGutenbergDirectory()
    {
        return ['templates/blocks'];
    }

And the blocks won't get displayed. However, when i install the plugin in my theme and autoload it, then it works..

EDIT:

Viewing your plugin file i have found out that this does not return true:

if ( is_callable( 'add_action' )
	&& is_callable( 'acf_register_block_type' )
	&& class_exists( 'Timber' )
) {
  add_action( 'acf/init', array( __CLASS__, 'timber_block_init' ), 10, 0 );
}

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

4 participants