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

Export to register_post_type and register_taxonomy #4

Open
szepeviktor opened this issue Oct 6, 2017 · 9 comments
Open

Export to register_post_type and register_taxonomy #4

szepeviktor opened this issue Oct 6, 2017 · 9 comments
Assignees

Comments

@szepeviktor
Copy link

szepeviktor commented Oct 6, 2017

Sometimes I use Pods to generate parameters (PHP code) for register_post_type() and register_taxonomy(). Then Pods will be disabled.

https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/mu-pods-register-export/pods-register-export.php

Needs a one-line modification!

@sc0ttkclark
Copy link
Member

What modification was that exactly? Happy to bring your tweak over here.

@sc0ttkclark sc0ttkclark self-assigned this Oct 6, 2017
@szepeviktor
Copy link
Author

szepeviktor commented Oct 6, 2017

Thanks.
var_export instead of var_dump in pods_debug() to make it reversible.

I know I could go pods_api()->load_pods... but it would need a big chunk of copy of the Pods plugin.

@sc0ttkclark
Copy link
Member

Where are you calling pods_debug() in that code?

@sc0ttkclark
Copy link
Member

Oh nevermind, I see now it's via the pods_debug_register param flag

@szepeviktor
Copy link
Author

szepeviktor commented Oct 6, 2017

Nowhere! 😄
Its output is caught and reversed (eval-ed) into PHP arrays.

@szepeviktor
Copy link
Author

szepeviktor commented Oct 6, 2017

I would rewrite it if you give me instructions that will end up in under 100 lines of code.

sc0ttkclark added a commit to pods-framework/pods that referenced this issue Oct 6, 2017
@sc0ttkclark
Copy link
Member

sc0ttkclark commented Oct 6, 2017

I think what you came up with is clever, but this PR should make it easier to do what you want:

pods-framework/pods#4498

In Pods 2.7, you can hook into the pods_register_taxonomy and pods_register_post_type filters to collect all of the registrations that you'd like, the you can rebuild the register_post_type / register_taxonomy statements to use with your own export code easily from there.

I'll add an option to export to register_post_type / register_taxonomy in this Export to Code plugin too.

@sc0ttkclark sc0ttkclark changed the title Alternative for CPT-s and taxonomies only Export to register_post_type and register_taxonomy Oct 6, 2017
@szepeviktor
Copy link
Author

I'll start the rewrite as it is released on WP.org.

@szepeviktor
Copy link
Author

I'll add an option to export to register_post_type / register_taxonomy in this Export to Code plugin too.

Thank you!

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

No branches or pull requests

2 participants