Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

nextart on "[Plugin: Polylang] retrieve post language in back end"

$
0
0

Hi i use this function

add_filter( 'default_content', 'my_editor_content', 10, 2 );
function my_editor_content( $content, $post ) {
    switch( $post->post_type ) {
        case 'corso':
            $content = '';
        break;
        case 'olea':
            $content = '';
        break;
        default:
            $content = "<br><br><br>
			[tab name='CARATTERISTICHE TECNICHE']
	[/tab]
[tab name='FUNZIONI AVANZATE']

[/tab]
[tab name='IMMAGINI CLINICHE']

[/tab]
	[end_tabset]
			";
        break;
    }

    return $content;
}

to add defaut text to the post... BUT i have two languages so if the new post is in English i need to show that text in english.
in front end with
<?php echo "lingua: ".pll_current_language(slug);?>
i retrieve the current post language
but in backend how can i retrieve the language of the new post?

bye
Maurizio

https://wordpress.org/plugins/polylang/


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>