WordPress.org

Ready to get started?Download WordPress

Forums

Google XML Sitemaps v3 for qTranslate
qTranslate Slug + XML (1 post)

  1. Curky
    Member
    Posted 6 months ago #

    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.

    Best
    Mirza

    http://wordpress.org/plugins/google-xml-sitemaps-v3-for-qtranslate/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.