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

Allow themes and plugins to add their own custom content hooks #40

Closed
wants to merge 1 commit into from
Closed

Allow themes and plugins to add their own custom content hooks #40

wants to merge 1 commit into from

Conversation

funkjedi
Copy link
Contributor

Trigger a custom event when addCustomContentHooks is called to allow themes and plugin developers to add their own custom content hooks.

Usage example:

jQuery(document).on('qTranslateX:addCustomContentHooks', function(event, qtx, form) {

    jQuery('.acf-field-text .acf-input-wrap input').each(function() {
        qtx.addContentHookById(this.id, form);
    });

});

@johnclause
Copy link
Member

Hi Tim, this is an interesting idea - thank you. I am also trying to implement the best possible way to integrate and that is being developed like every day. Have you seen the code of plugins:

https://github.com/qTranslate-Team/woocommerce-qtranslate-x
https://github.com/qTranslate-Team/wp-seo-qtranslate-x
https://github.com/qTranslate-Team/events-made-easy-qtranslate-x

The last one, events-made-easy, is incomplete, but it has the most of comments and explanations, since I was preparing it for the author of Events Made Easy (https://wordpress.org/plugins/events-made-easy/) to finish the code.

The idea is that, eventually, users and plugin authors will be able to submit a custom configuration as an xml or json text or file, which will describe the fields need to be translatable. For now, we code the array needed and submit it through a hook.

I believe you can achieve what you need with already existent hooks, following the pattern of the plugins mentioned above.

Please, take a look and let me know what you think.

@funkjedi
Copy link
Contributor Author

Brilliant worked like a charm.

@johnclause
Copy link
Member

Hi Tim, were you able to complete all what you need? Which plugin is that? Should I listed it on the Description page as an example of integration?

@funkjedi
Copy link
Contributor Author

The qtranslate_load_admin_page_config filter did the job splendidly. The plugin's called ACF qTranslate and absolutely feel free to put it as an example.

@johnclause
Copy link
Member

I listed it on the description page. I believe you have made many people happy with this plugin! Thank you.

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

Successfully merging this pull request may close these issues.

None yet

2 participants