• Resolved Chris

    (@chrisbup)


    I’m fairly new to WordPress backend. How can I manually include Gutenberg in a custom theme? I’ve installed in WP admin, have downloaded Gutenberg, and added it to my app > lib directory (as our team has done for other plugins). But when I add require_once('lib/gutenberg/gutenberg.php'); to app/libraries.php, I get multiple errors saying things like Gutenberg version already defined and cannot redeclare gutenberg_can_init. Any ideas?

    • This topic was modified 7 years, 6 months ago by Chris.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tammie Lister

    (@karmatosed)

    Hi there, can I ask what you are trying to do by including Gutenberg in your theme? I ask as it doesn’t need to be included and should work just with any theme. Are you trying to do something more than just use it with your theme?

    Chrisbup,

    You don’t need to include the plugin in your theme. Undo the changes you have made and install the plugin like this:

    Dashboard > Plugins > Add New > Upload Plugin > Browse > Open > Activate

    You will then see a ‘Gutenburg’ link in your dashboard menu from which you can create a new post.

    Thread Starter Chris

    (@chrisbup)

    Yeah, I’ve been told that for custom themes, it’s good practice to include plugins in the lib directory so that theme is self-contained, with any dependent plugins specified. For example, we also have this line in libraries.php: require_once('lib/acf.php'); and corresponding acf directory and acf.php file there as well.

    I already have Gutenberg installed as described above. This is just the company’s way of doing it and I’m trying to understand this use of libraries.php myself. We’re using the Sage WordPress starter theme.

    • This reply was modified 7 years, 6 months ago by Chris.

    Chris,

    That’s not a good way to do things. There is no need to include plugins in the lib directory for any theme.

    About the only time you ‘might’ need to do this is if a plugin is necessary for a theme to function. But even then it’s just not necessary.

    However, this is going a bit off topic. If you now have Gutenburg installed you can have a play and see if it works for you (it didn’t impress me much).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to manually install’ is closed to new replies.