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

Querying Options Pages #6

Open
Ninodevo opened this issue Nov 19, 2020 · 15 comments
Open

Querying Options Pages #6

Ninodevo opened this issue Nov 19, 2020 · 15 comments

Comments

@Ninodevo
Copy link

Is it possible to query option pages (created with ACF) in different languages?

@rburgst
Copy link
Owner

rburgst commented Nov 20, 2020

I am not sure what you mean by option pages.

@Ninodevo
Copy link
Author

@Ninodevo
Copy link
Author

I figured out how to make this work. I'll make a fork

@rburgst
Copy link
Owner

rburgst commented Nov 20, 2020

PRs are always welcome!

@simongoot
Copy link

@Ninodevo how did you solve getting Option pages from all languages?

@Ninodevo
Copy link
Author

@simongoot I've created a CPT "option pages" and had them translated I didn't manage to get ACF Options Pages in other languages

@simongoot
Copy link

Any progress on getting options pages translated @rburgst ?

@Ririshi
Copy link

Ririshi commented Jan 11, 2023

I'm hoping someone made some progress on this since. Would it be possible to add a "where" argument to options page queries like they exist for custom post types? That way, one could query the options given a specific language.

@akkis
Copy link

akkis commented Feb 1, 2023

Really need this functionality. Any progress/solution?

@Ririshi
Copy link

Ririshi commented Mar 21, 2023

I'm trying to make this work in a fork. There don't seem to be any hooks in the WP GraphQL for ACF code to hook into the options pages anywhere. I tried to add a wpmlLanguage argument to each options page field, by deregistering and re-registering the options pages fields. This doesn't work because the fields seem to lose their ACF group resolvers (which are programmatically registered after the options page fields are), so all fields inside a group return null when using this method.

If anyone can help to come up with a working fix, that'd be appreciated. My next step / attempt will be to try to manually register all options pages again and then run the code from WP GraphQL for ACF to add the groups to the options page fields.

Ririshi@74e0c6b

@rburgst
Copy link
Owner

rburgst commented Mar 21, 2023

Imho unregistering Graphql fields won’t achieve a lot. You need to see how the data is loaded within WordPress and what wpml is doing to prevent all options to appear. Then you need to check whether there is a way to prevent wpml from doing that. Typically this is done by overwriting some wpml state variables.
this is why debugging and trying to implement features like this is so very tedious and time consuming.

@Ririshi
Copy link

Ririshi commented Mar 22, 2023

Normally, the query for an options page returns only one page, there is no way to return all options pages at once. So each of those queries returns one page, in the default language. My goal is to add an argument to each of those queries, and use the argument to change the active language in WPML / sitepress. At least for my usecase, it should function similarly to PR #32.

@Ririshi
Copy link

Ririshi commented Mar 22, 2023

I just managed to solve this issue, quite simply. The issue I encountered previously was caused by me missing a line of code that sets the type of the options page to "options_page", while registering the options page fields again. I created a PR #42. Hoping it can be merged quickly with a tag version bump, so we can use the official package in our project :)

@Ririshi
Copy link

Ririshi commented Apr 4, 2023

For those who need this functionality, you can use this branch on my fork until the PR is accepted.

@Seabon
Copy link

Seabon commented Apr 13, 2023

+1

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

No branches or pull requests

6 participants