Forum Replies Created
-
AuthorPosts
-
Mauro
ParticipantAwesome thanks! I'll play with this and let you know how it goes.
Mauro
ParticipantIn the short term, it would be ideal if you circulated a couple different composer.json files with all meta-box components already set up.
One version would just install everything in wp-content/plugins, the other one should instead go get the plug-ins and install them in a custom path, as a part of our own custom plug-in (or theme). And ideally it should "just work".
As a long term solution, I think MetaBox AIO is a step in the right direction -- but I couldn't make it work.
IMHO it should include everything from MetaBox.io (not just the premium extensions), have a settings panel (for users) and a config file (for developers) to decide what components to activate, and a flag to show/hide the settings UI panel -- and of course one would need the API Key to make the premium components work.Then you could have just that one as a composer package.
Just my 2 cents ๐Mauro
ParticipantThanks for this!
I'm still running into a few issues.I added all components I need and I've run composer install. The result differs from the composer install of metabox as documented on this site elsewhere since that one installed meta-box within the vendor/ directory.
This method instead created a wp-content/plugins/ directory into my target directory, and now the autoload.php returns an error because it can't find the plugins.
---- This is my composer.json ----
{
"repositories": [
{
"type": "composer",
"url": "https://packages.metabox.io/XXX"
},
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"require": {
"meta-box/meta-box-group": "dev-master",
"meta-box/meta-box-columns": "dev-master",
"meta-box/mb-custom-table": "dev-master",
"meta-box/mb-revision": "dev-master",
"meta-box/mb-term-meta": "dev-master",
"meta-box/meta-box-geolocation": "dev-master",
"meta-box/meta-box-tabs": "dev-master",
"wpackagist-plugin/meta-box": "dev-trunk",
"wpackagist-plugin/mb-rest-api": "dev-trunk",
"wpackagist-plugin/mb-relationships": "dev-trunk"
},
"extra": {
"installer-paths": {
"meta-box/meta-box/": ["my-foundation/meta-box"],
"meta-box/mb-rest-api/": ["my-foundation/mb-rest-api"],
"meta-box/mb-relationsihps/": ["my-foundation/mb-relationships"]
}
},
"autoload": {
"files": [
"meta-box/meta-box/meta-box.php",
"meta-box/mb-rest-api/mb-rest-api.php",
"meta-box/mb-rest-api/mb-rest-api.php"
]
}
}---- This is composer's output ----
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 11 installs, 0 updates, 0 removals
- Installing composer/installers (v1.5.0): Downloading (100%)
- Installing meta-box/meta-box-group (master): Downloading (100%)
- Installing meta-box/meta-box-columns (master): Downloading (100%)
- Installing meta-box/mb-custom-table (master): Downloading (100%)
- Installing meta-box/mb-revision (master): Downloading (100%)
- Installing meta-box/mb-term-meta (master): Downloading (100%)
- Installing meta-box/meta-box-geolocation (master): Downloading (100%)
- Installing meta-box/meta-box-tabs (master): Downloading (100%)
- Installing wpackagist-plugin/meta-box (dev-trunk): Checking out trunk
- Installing wpackagist-plugin/mb-rest-api (dev-trunk): Checking out trunk
- Installing wpackagist-plugin/mb-relationships (dev-trunk): Checking out trunk
Writing lock file
Generating autoload files
I added require_once('vendor/autoload.php'); to my core plug-in file and now I get this error:
Fatal error: require(): Failed opening required '/Users/mauro/GitHub/my_wordpress/wp-content/plugins/my-foundation/vendor/composer/../../meta-box/meta-box/meta-box.php' (include_path='.:/Applications/MAMP/bin/php/php7.2.1/lib/php') in /Users/mauro/GitHub/mundana_wordpress/wp-content/plugins/my-foundation/vendor/composer/autoload_real.php on line 66
Mauro
ParticipantThanks for the pointer! I tried it and my composer.json file is attached.
I get the following errors:
Problem 1
- The requested package meta-box/mb-relationships could not be found in any version, there may be a typo in the package name.
Problem 2
- The requested package meta-box/mb-rest-api could not be found in any version, there may be a typo in the package name.-- composer.json --
{
"repositories": [{
"type": "composer",
"url": "https://packages.metabox.io/[my api key]"
}],
"require": {
"meta-box/meta-box-group": "dev-master",
"meta-box/meta-box-columns": "dev-master",
"meta-box/mb-custom-table": "dev-master",
"meta-box/mb-relationships": "dev-master",
"meta-box/mb-rest-api": "dev-master",
"meta-box/mb-revision": "dev-master",
"meta-box/mb-term-meta": "dev-master",
"meta-box/meta-box-geolocation": "dev-master",
"meta-box/meta-box-tabs": "dev-master"
}
}Mauro
ParticipantWorks great now!... So I assume the MetaBox Builder field should not be there, or the code generated should add the filter for me.
One question, I can show the address I type on the map, and the pin is placed in the correct location.
If I place the red pin elsewhere can I have it populate the address using the position of the pin instead?
Mauro
ParticipantOh, no I didn't do that. I thought that once I specified the storage and table name in the meta box args, it would automatically create and manage the table for me, and that the alternative to create it manually was optional. Will try and let you know.
So I assume if I switch to a custom table, existing data is not migrated automatically?
Mauro
ParticipantI tried moving the MetaBox code that was generated by the builder to a custom plug-in.
I get the same error: the database table does not get created.Mauro
ParticipantHello, this is pretty important to me since this is the main reason I'm looking into MetaBox as an alternative to CMB2.
Mauro
ParticipantIt appears this is possible only through code (not within the meta box builder) by specifying show_in_menu => 'edit.php?post_type=[your_custom_post_type_slug]'
Reference: https://codex.wordpress.org/Function_Reference/register_post_type
Mauro
ParticipantI checked on my DB and no table was created. I guess the hook to create the table isn't triggered when I update the metabox?
-
AuthorPosts