Closed ifoi closed 1 year ago
Thanks for the contribution. I will only be able to look into this pull request in a few weeks when I come back from a business trip. I am not planning any updates to Link Library so no worries about an update overwriting your local changes. Instead of putting all of these parameters directly in the post type definition, I might check to see if I can detect the installation of this graphql plugin and only then add the extra parameters.
Yannick
On Tue, Oct 18, 2022 at 3:48 PM Ifo Ikede @.***> wrote:
I am trying to use links library with a headless wordpress, I noticed that the library data was not been exposed to graphql, so i added the graphql support.
I followed the suggestions in this post .. https://www.thestrugglingdeveloper.com/2020/12/03/how-to-add-or-expose-a-custom-posttype-in-wpgraphql-extension/ http://url
You can view, comment on, or merge this pull request online at:
https://github.com/ylefebvre/link-library/pull/15 Commit Summary
- 735f49e https://github.com/ylefebvre/link-library/pull/15/commits/735f49e7526e0eed8c2b591f1dd1e1acfd881da6 Add WPgraphql support
File Changes
(1 file https://github.com/ylefebvre/link-library/pull/15/files)
- M link-library.php https://github.com/ylefebvre/link-library/pull/15/files#diff-b5a87d4edbb599a6b1094e6c53f752f3b48fd7abfacc3a409bcac2cfd8ef31b4 (4)
Patch Links:
- https://github.com/ylefebvre/link-library/pull/15.patch
- https://github.com/ylefebvre/link-library/pull/15.diff
— Reply to this email directly, view it on GitHub https://github.com/ylefebvre/link-library/pull/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCYFXYUXIFV6ZOEWYYHBCDWD35HFANCNFSM6AAAAAARINOINQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Regarding checking to sere if graphql is installed, before enabling support for it. What if graphql plugin is installed after Link-library ?
Which reminds me, if i want to make sure that my updates are being used, do i have to deactivate and reactive the plugin? SO that it reloads " link-library.php "
More or less asking if my edits to link-library.php are reloaded by WordPress upon saving the file.? because at the moment, the nodes are note showing up on WpGraphql.
have a good trip and hello from a fellow Canuck.
The approach I took to detect if GraphQL was installed was the following:
if ( class_exists( 'WPGraphQL' ) ) { $post_type_args['show_in_graphql'] = true; $post_type_args['hierarchical'] = true; $post_type_args['graphql_single_name'] = 'linklibrary'; $post_type_args['graphql_plural_name'] = 'linklibrary'; }
With this technique, the extra array elements are added into the post type argument array if it detects that the class is present. The order in which plugins are installed does not matter. This checks if the plugin is running on the site. This code change is available in version 7.4.1.
I am trying to use links library with a headless wordpress, I noticed that the library data was not been exposed to graphql, so i added the graphql support.
I followed the suggestions in this post .. https://www.thestrugglingdeveloper.com/2020/12/03/how-to-add-or-expose-a-custom-posttype-in-wpgraphql-extension/