Stars: 151
Forks: 26
Pull Requests: 21
Issues: 65
Watchers: 11
Last Updated: 2023-08-09 10:04:20
A WordPress plugin for adding ACF options page support for Polylang.
License: Other
Languages: PHP
You are using Advanced Custom Fields for creating option pages and you have Polylang installed for awsome multilingual site ?
Sadly, Polylang is not handling ACF's Option Pages. Which means values will be the same for all languages you have set.
We are here to save your life ! Once this plugin is activated, you will be able to set a different value for each language, and if none is set, the "All languages" value will be used as default one.
This plugin will store a value for each language into database. Then Polylang's languages are used to get the values from the DB. That means at activation, all existing data will not be anymore available, but still in database. You will retrieve it ad plugin deactivation.
Then to set and contribute your option page, simply use the Polylang's language admin flags ui.
First activate and configure Polylang in you site. Then activate ACF Options For Polylang to handle ACF Options in setted Polylang's languages.
acf-options-for-polylang
directory into mu-plugins.composer require wpackagist-plugin/acf-options-for-polylang
As you can see, some issues are feature requests :
Please refer to the contributing guidelines to increase the chance of your pull request to be merged and/or receive the best support for your issue.
If you identify any errors or have an idea for improving the plugin, feel free to open an issue. Please provide as much info as needed in order to help us resolving / approve your request.
Nothing change, we have made all the hooks for you, so no need to prefix your fields with a lang or something else. Only use ACF's helpers to get and show the fields as you did before with get_field() or the_field() :
get_field( 'footer_disclaimer', 'options' );
If you don't want this functionality on a certain options page, add the post_id
to the list of excluded options pages.
add_filter( 'bea.aofp.excluded_post_ids', function($ids) {
$ids[] = 'custom_options_page_post_id';
return $ids;
}, 10, 1 );
The plugin is designed to get the Polylang "All languages" value if the current lang one is empty. But if you are not interested about this behaviour, you can programmatically deactivate it using the following filter by setting to false.
<?php add_filter( 'bea.aofp.get_default', '__return_false' );
<?php add_filter( 'bea.aofp.get_default', function( $show_default, $post_id ) {
if ( 'my_custom_acf_option_post_id' === $post_id ) {
// Custom condition for the wanted post id ACF Option page
return false;
}
return $show_default;
}, 10, 2 );
Created by Be API, the French WordPress leader agency since 2009. Based in Paris, we are more than 30 people and always hiring some fun and talented guys. So we will be pleased to work with you.
This plugin is only maintained, which means we do not guarantee some free support. Consider reporting an issue and be patient.
If you really like what we do or want to thank us for our quick work, feel free to donate as much as you want / can, even 1€ is a great gift for buying cofee :)
BEA - ACF Options for Polylang is licensed under the GPLv2 or later.