Support » Plugin: Google XML Sitemaps v3 for qTranslate » qTranslate Slug XML

  • Hi guys I recently had a client which needed to have the qTranslate slugs appear in the XML sitemap.

    After checking out tons of forums I found a piece of code which solved my problem.

    // Add an extra permalink url for every non-default qTranslate language
    foreach ($languages as $language) {
    if ($qt[“hide_default_language”] == 1 && $qt[“default_language”] == $language) {
    $sitemap->AddUrl($permalink, $modified_time, $change_freq, $priority);
    } else {
    // get id
    $id = url_to_postid($permalink);
    // get object post
    $post = get_post($id);
    // get slug translation with post->ID
    $title = get_post_meta($post->ID, “_qts_slug_”.$language, true);
    if ($title) // if slug translation exist, add to sitemap
    $sitemap->AddUrl(home_url().”/$language/”.$title.”/”, $modified_time, $change_freq, $priority);

    Maybe you should add this to your new version ? Add a checkbox or some if statement if qTranslate Slug is activated to use this to rewrite the links.


  • The topic ‘qTranslate Slug XML’ is closed to new replies.