Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,

    I just want to share my temporary fix.

    Here’s my Polylang (version 1.6.4) options
    – 2 lang (“en” set as default + “fr”);
    – Language determine by directory;
    – Default language is not hidden.

    Here’s what I observed
    – Editing Avada options in “All languages” update “Avada_options”;
    – Editing Avada options in “English” update “Avada_options”;
    – Editing Avada options in “French” update “Avada_options_fr”;
    – Accessing a french page for the first time create the option “Avada_options_fr” by making a copy of the option “Avada_options”.

    These code snippets can be injected in the “functions.php” of your theme or in your plugin.

    This one will assure that the “Avada_options” is load every time:

    // If trying to get the localized options...
    add_filter('option_Avada_options_fr', function($value) {
    	// Return the good ones.
    	return get_option('Avada_options');
    });

    These one will assure that you can update the theme options even if your not in the default or “All languages” polylang settings:

    // If trying to create localized options...
    add_action('add_option_Avada_options_fr', function($option, $value) {
    	// Delete the localized options just created.
    	delete_option('Avada_options_fr');
    	// Add/update the good ones.
    	update_option('Avada_options', $value);
    }, 10, 2);
    
    // If trying to update localized options...
    add_filter('pre_update_option_Avada_options_fr', function($value, $old_value) {
    	// Update the good ones.
    	update_option('Avada_options', $value);
    	// Return the same value for cancelling the update.
    	return $old_value;
    }, 10, 2);

    It’s the next item on my to-do list. I’ll keep you update.

    Thanks

    Ok! I’ll try to add this. But like I said, I did this for a particular project but keeping in mind that it can evolve as a general plugin or add to the core of Polylang so not all functionnalities of Polylang work for now and there is probably a lot of work to do so.

    Hi!,

    I wrote a little plugin to handle translations of custom post type rewrite slugs.

    I use it with lang prefix in URL (/en/my_post_type/title, /fr/mon_type_darticle/titre).

    It also handle correct translation for “get_permalink()” function;

    To translate your post types slugs, install/activate my plugin and use this code in your functions.php or in your plugin:

    add_filter('pll_translated_post_type_rewrite_slugs', function($post_type_translated_slugs) {
    	// Add translation for "my_post_type".
    	$post_type_translated_slugs['my_post_type'] = array(
    		'en' => 'my-english/rewrite-slug',
    		'fr' => 'my-french/rewrite-slug',
    	);
    	// Add translation for "product".
    	$post_type_translated_slugs['product'] = array(
    		'en' => 'products',
    		'fr' => 'produits',
    	);
    	return $post_type_translated_slugs;
    });

    It is really NOT well tested. It work for the specified configuration: not a multisite, language determine by folder (prefix /en, /fr) and only with post types slugs. But hey, it’s a start:)

    For now, it’s on a GitHub repo so if you want to make it better, just fork it. Maybe this could be eventually merge to Polylang, we’ll see.

    Polylang – Translate URL Rewrite Slugs
    GitHub Repo
    Download latest version as zip

    Plugin Author KLicheR

    (@klicher)

    Hi,

    I don’t test it on multisite but this plugin is closely inspired by the WordPress plugin WordPress Importer so I guess it is.

    If you find out, let me know:)

    Plugin Author KLicheR

    (@klicher)

    Hi,

    Sorry for the delay, I’m not really familliar with the WordPress forum/support thing.

    Yes, the plugin is just downloading images.

    It read your DB for attachments entries you have and if you don’t have the file corresponding, it will try to download it from the URL you specified.

    Here’s an example of use. You want to start developping on an ongoing project. You checkout the code locally but not the “uploads” folder. If you use a VCS like Git, Mercurial or SVN, you normally don’t versionned the “uploads” folder cause it is too heavy. So you also dump the DB from your production site that contain entries for attachments. The only thing is missing are the image files and it’s where the plugin is useful.

    When you’re developping, maybe other contents has been added to the production site with images. To update your developpement site, you’ll dump the DB and import it to your local site but again, images are missing. The plugin will retrieve them.

    This plugin is maybe more adapted to a certain way of sites developpement.

    I hope I answer your question and thanks for your interest.

    Plugin Author KLicheR

    (@klicher)

    Hi!,

    Thanks for taking the time to write about your problems with the plugin.

    I fix something with URL trailing slash and add a report when the import operation end. If you want to see a detailled report of each operation, you can add this line to your wp-config.php file:

    define('ATTACHMENT_FILES_IMPORT_DEBUG', true);

    If the new version 0.2 doesn’t fix your problem, you can send me the errors of the detailled report and I’ll try to help you.

    Thanks again

Viewing 7 replies - 1 through 7 (of 7 total)