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

Comments

Projects
None yet
2 participants
@szepeviktor

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

This comment has been minimized.

Show comment
Hide comment
@sc0ttkclark

sc0ttkclark Oct 6, 2017

Member

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

Member

sc0ttkclark commented Oct 6, 2017

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

@sc0ttkclark sc0ttkclark self-assigned this Oct 6, 2017

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor 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.

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

This comment has been minimized.

Show comment
Hide comment
@sc0ttkclark

sc0ttkclark Oct 6, 2017

Member

Where are you calling pods_debug() in that code?

Member

sc0ttkclark commented Oct 6, 2017

Where are you calling pods_debug() in that code?

@sc0ttkclark

This comment has been minimized.

Show comment
Hide comment
@sc0ttkclark

sc0ttkclark Oct 6, 2017

Member

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

Member

sc0ttkclark commented Oct 6, 2017

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

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Oct 6, 2017

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

szepeviktor commented Oct 6, 2017

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

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Oct 6, 2017

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

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

Move post type / taxonomy registration
To make things like pods-framework/pods-export-code#4 easier to accomplish.
@sc0ttkclark

This comment has been minimized.

Show comment
Hide comment
@sc0ttkclark

sc0ttkclark Oct 6, 2017

Member

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.

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 from Alternative for CPT-s and taxonomies only to Export to register_post_type and register_taxonomy Oct 6, 2017

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Oct 6, 2017

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

szepeviktor commented Oct 6, 2017

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

@szepeviktor

This comment has been minimized.

Show comment
Hide comment
@szepeviktor

szepeviktor Oct 6, 2017

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

Thank you!

szepeviktor commented Oct 6, 2017

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