Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #722842

    Hi,
    i’ve installed the POLYLANG-Plugin to have a multilanguage Site. Everything ist fine, but when i want to create a new translation (Click on “Plus-Icon”) for an existing Site, the RTE (Avia Layout Architekt) is empty (normaly there apperas the original Content for example from the German-Site)

    Can you please help me?
    Thanks!

    Best Regards,

    Daniel

    • This topic was modified 7 years, 11 months ago by danielrad78.
    #722868

    Hi Danielrad78, I’m not from kriesi support team, but after read your message I would like to help you. I use Enfold with polylang and after apply few custom functions I translate 100% of content.

    To use custom header text/extra elements in enfold options need this code:

    /**
     * [polylang lang="en"]English[/polylang][polylang lang="es"]Spanish[/polylang]
     */
    function polylang_shortcode($atts, $content = null)
    {
    	if (empty($content))
    		return '';
    	extract( shortcode_atts( array('lang' => ''), $atts ) );
    	if (empty($lang))
    		return "<h3>You must specify 'lang' using shortcode: polylang</h3>";
    
    	return ($lang == pll_current_language()) ? $content : '';
    }
    add_shortcode('polylang', 'polylang_shortcode');

    Then you can use –> [polylang lang=”en”]English content[/polylang][polylang lang=”es”]Spanish content[/polylang]

    To create copy of title / content on translation need this:

    
    /**
     * Make sure Polylang copies the content when creating a translation
     */
    function jb_editor_content( $content ) {
        // Polylang sets the 'from_post' parameter
        if ( isset( $_GET['from_post'] ) ) {
            $my_post = get_post( $_GET['from_post'] );
            if ( $my_post )
                return $my_post->post_content;
        }
    
        return $content;
    }
    add_filter( 'default_content', 'jb_editor_content' );
    
    /**
     * Make sure Polylang copies the title when creating a translation
     */
    function jb_editor_title( $title ) {
        // Polylang sets the 'from_post' parameter
        if ( isset( $_GET['from_post'] ) ) {
            $my_post = get_post( $_GET['from_post'] );
            if ( $my_post )
                return $my_post->post_title;
        }
    
        return $title;
    }
    add_filter( 'default_title', 'jb_editor_title' );

    To delete language category on blog entries:

    
    function avia_exclude_tax($tax,$post_type,$id){
        $tax = array_merge($tax, array('language', 'term_language', 'post_translations', 'term_translations'));
        return $tax;
    }
    add_filter('avf_exclude_taxonomies', 'avia_exclude_tax', 10, 3);

    To use ajax search with current language only:

    
    
    /**
     * Ajax Search Query current language
     */
    function avf_modify_ajax_search_query($search_parameters)
    {
        $language = pll_current_language();
        parse_str($search_parameters, $params);
        $params['lang'] = $language; 
        $search_parameters = http_build_query($params);
        return $search_parameters;
    }
    add_filter('avf_ajax_search_query', 'avf_modify_ajax_search_query', 10, 1);
    
    function avf_modify_ajax_search_messages($search_messages)
    {
    	    $search_messages[all_results_link] = pll_home_url().'?'.http_build_query($_REQUEST);
            $search_messages[no_criteria_matched] = '<a class=\'ajax_search_entry ajax_search_entry_view_all\' href=\'' .$search_messages['all_results_link'].'\'>'.$search_messages['view_all_results'].'</a>';
        return $search_messages;
    }
    add_filter('avf_ajax_search_messages', 'avf_modify_ajax_search_messages', 10, 1);

    Then, from Settings/Languages/Strings translations you can translate widgets.

    I hope this helps you…

    Gabri

    #723026

    Hi @Gabri,

    Thank you very much for sharing that!

    Did you try it out and did you have any luck with it @danielrad78?

    Best regards,
    Rikard

    #723174

    Hello!
    Thanks a lot. This worked fine!

    Is it possible, to set the Avia Layout Builder as standard-Editor? Now i allways have to click on tjhe blue button “Erweiterter Layout Editor”.

    Thanks!

    #723567

    Hi @danielrad78,

    Great, glad you got it working :-)

    You only have to do that the first time, once you have saved the post the editor which was active when you saved should appear automatically.

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.