Forums

Default page/post titles for bilingual blog (2 posts)

  1. davaidesign
    Member
    Posted 3 years ago #

    I am putting together a community site that supports two languages using the langswitch plugin, which works by displaying the text between the [lang_en] [/lang_en] in English and [lang_fr] [/lang_fr] in French. I wanted to set up the post editor so that these tags are included by default in both the title box and text area. I managed to get it done for the text area with this piece of code in the functions.php file of the theme:

    <?php
    
    add_filter( 'default_content', 'my_editor_content' );
    
    function my_editor_content( $content ) {
    
    	$content = "[lang_en]\nEnglish text here\n[/lang_en]\n[lang_fr]\nFrench text here\n[/lang_fr]";
    
    	return $content;
    }
    
    ?>

    I want to do the same this for the title, where it would have [lang_en]English title here[/lang_en][lang_fr]French title here[/lang_fr] when post-new.php is loaded.

    I don't want to hack the core files as it's a big no no. Is there anything out there that could do the trick?

  2. davaidesign
    Member
    Posted 3 years ago #

    bump

Topic Closed

This topic has been closed to new replies.

About this Topic