Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter hermes3por3

    (@hermes3por3)

    Lovely! And the attachment filter also works like a charm. Thanks!

    I have tested your branch WPMLcompat and it works perfectly with WPML and W3 Total Cache!

    Hi, yes I’ve got it running with the latest. I’ll try the github and will let you know.

    I have made this plugin compatible with WPML doing some changes in 2 files. I use this plugin instead of YOAST’s xml (or others) because with these changes I can populate all languages stemming from a single xml sitemap, which is good to combine with W3 Total Cache because W3 Total Cache uses a single XML sitemap to prime all cached posts & pages.

    I’ll post the changes here, hopefully they’ll be understandable to @RavanaH (it’s heavily indented). The idea is to check for global variable $sitepress in addition to $polylang and then do the logic there. Also, in the sitemap index, include the other languages.

    XML SITEMAPS FEED
    =================

    /wp-content/plugins/xml-sitemap-feed/includes/core.php

    added support for WPML language urls settings, not just polylang. This will affect everywhere where there is polylang stuff.

    line 378 | function is_home($id) Where it checks for global $polylang, we change the code to this:

    global $polylang;
    	global $sitepress;
    	if ( isset($polylang) ){
    		$this->blogpage = $polylang->get_translations('post', $blogpage);
    	}else if(isset($sitepress)
    			&& function_exists('icl_xml_post_languages')){
    		$this->blogpage = icl_xml_post_languages('post', $blogpage);
    	}
    	else
    		$this->blogpage = array($blogpage);

    line 625 | function get_home_urls() Where it checks for global $polylang, we change the code to this:

    global $polylang, $q_config, $sitepress;
    
    	if (isset($polylang)) {
    		foreach ($polylang->get_languages_list() as $term)
    			$urls[] = $polylang->get_home_url($term);
    	} else if (isset($sitepress)
    			&& function_exists("icl_get_languages")) {
    		$iclLanguages = icl_get_languages('skip_missing=1');
    		if (!empty($iclLanguages)) {
    			foreach ($iclLanguages as $iclLang) {
    				if ($iclLang['active']) {
    					$urls[] = $iclLang['url'];
    				}
    			}
    		} else {
    			$urls[] = icl_get_home_url();
    		}
    	} else {
    		$urls[] = home_url();
    	}

    line 645 | function get_excluded($post_type) here it checks for global $polylang, we change the code to this:

    global $polylang, $sitepress;
    	if (isset($polylang)) {
    		$exclude += $polylang->get_translations('post', $id);
    	} else if (isset($sitepress)
    			&& function_exists("icl_xml_post_languages")) {
    		$exclude += icl_xml_post_languages('post', $id);
    	} else {
    		$exclude[] = $id;
    	}

    /wp-content/plugins/xml-sitemap-feed/includes/feed-sitemap.php

    Before
    </sitemapindex>
    add into the index sitemaps the sitemap indexes corresponding to every language.

    // language specific sitemaps appear only in default language.
    // Otherwise W3 Total Cache enters an infinite loop
    
    global $sitepress;
    if (isset($sitepress)
    		&& function_exists(icl_get_languages)):
    	if (icl_get_current_language() == icl_get_default_language()):
    		$iclLanguages = icl_get_languages('skip_missing=1');
    
    		if (!empty($iclLanguages)):
    			foreach ($iclLanguages as $iclLang):
    				if (!$iclLang['active']):
    					?>
    					<sitemap>
    						<loc><?php echo $iclLang['url'] . 'sitemap.xml'; ?></loc>
    						<lastmod><?php echo mysql2date('Y-m-d\TH:i:s+00:00', get_lastdate('gmt'), false); ?></lastmod>
    					</sitemap>
    					<?php
    				endif;
    
    			endforeach;
    		else:
    			$urls[] = icl_get_home_url();
    		endif;
    	endif;
    
    endif;

    That should be it

    Thread Starter hermes3por3

    (@hermes3por3)

    Hi, finally I managed to make it work. Well I just uploaded the website at my production server and voilà. Flawlessly.

    Somehow if the website is running at localhost something gets lost somewhere (or maybe at any domain which points to 127.0.0.1 as told to the OS by the hosts file, which is what I did with example.com)

    Keep up the good work!

    Thread Starter hermes3por3

    (@hermes3por3)

    Hi, the first link does not work, it is https://www.flumo.com

    Hi Ryan, I am experiencing more or less the same. I haven’t upgraded to WordPress 2.5. I manually reinstalled WordPress 1.5 in a website (www.flumo.com) recreating the database and importing its contents, editing the config.php file so that it pointed to the right database server etc. I did the same with the same database in another server and this didn’t happen. Did you find a solution for this?

Viewing 7 replies - 1 through 7 (of 7 total)