• Hi wpForum,

    I’d like to change a page content at runtime because qTranslate doesn’t work fine on 3.7.1. So I’d like to change url or page content i.e.

    <?php
    					$language = $_GET['lang'];
    					if (!empty($language)) {
    						if (($language == 'en') ) {
    							 wp_redirect( 'https://url?page_id=996', 301 ); exit;
    										    }
    								}
    					?>

    Is it possible?

    Tia

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m uncertain what you have in mind exactly. Perhaps Multilingual WordPress will give you ideas for an approach.

    Thread Starter nesar77

    (@nesar77)

    Hi bcworkz,

    I’m using qTranslate plugin to translate pages and switch between different languages.

    qTranslate works fine but not on 3.7.1 so I’m not able to translate pages if they contains WP Pro Quiz shortcode .

    Is it possible to check language and redirect an url or change page content based on url parameter (i.e. &lang=de ) .

    Have you got any suggestions?

    Regards.

    Moderator bcworkz

    (@bcworkz)

    Yes, it’s possible, but the specifics will vary by how your translations are implemented and how the current language is kept track of.

    For example, I could get the current language from get_locale() and then alter which content is queried by hooking ‘pre_get_posts’. Your site may not track the current language that way, and the various translations may not be queryable that way.

    My limited understanding of qTranslate is the translations are stored in the same post. I imagine what is displayed on a page is filtered on output, and the language URL parameter is used somehow to determine what to filter out. The user’s language preference is surely stored somewhere, perhaps a cookie. That setting could influence how permalinks are built.

    This is all speculation, a thorough investigation of the plugin would reveal what really needs to be done. Sorry I can’t give you better advice.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change page content at runtime’ is closed to new replies.