Support » Plugins » Hacks » Change page content at runtime

  • 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.

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

    Is it possible?


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


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

    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?


    Moderator 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.