Adjust PS Auto Sitemap v1.1.3 with qTranslate v2.4.3 Plugins
Today I installed and used PS Auto Sitemap plugin for this website. It is a plugin that automatically generates a site map page from your WordPress site. Easy to install for beginners and easy to customize for experts. You may change the settings of the display of the lists from administration page. Several neat CSS skins for the site map tree also available. Since I also used qTranslate plugin for translating the content of my website, then I had to modify the script belongs to the PS Auto Sitemap plugin in order to be able displaying its content according to the current active language. Especially in the part of code for displaying the post title. Only small change, indeed.
Open ps_auto_sitemap.php file, and find this code:
233 234 235 | foreach( $category_posts as $post ) { $post_list_in_category .= "\t" . '<li class="post-item post-item-' . $post['ID'] . '"><a href="' . get_permalink( $post['ID'] ) . '" title="' . attribute_escape( $post['post_title'] ) . '">' . wp_specialchars( $post['post_title'] ) . "</a></li>\n"; } |
replace with:
233 234 235 | foreach( $category_posts as $post ) { $post_list_in_category .= "\t" . '<li class="post-item post-item-' . $post['ID'] . '"><a href="' . get_permalink( $post['ID'] ) . '" title="' . attribute_escape( wp_specialchars(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( ( $post['post_title'] )))) . '">' . wp_specialchars(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $post['post_title'] )) . "</a></li>\n"; } |
There was one special note that important to know (for those of you who have just used this plugin for the very first time). Perhaps, you will get confused (actually, this was also happened to me) when you see this plugin’s setting from admin panel. There is a PostID of the sitemap directive there. PostID here has the meaning as Page ID that you have to created first, since this site map content would be located on that page. I suggest to the author of this plugin, IMHO it would be better if we called it as PageID instead of PostID.
Now, let us back again to the main topic. After you create a new page, then please add this tag in the page content, while you are in HTML mode:
<!-- SITEMAP CONTENT REPLACE POINT -->
and then save this page. Afterwards, go to the list of your pages in admin panel. You will see from your list of the pages, the ID number of that new page you have just added. Enter that page ID to the PostID of the sitemap, and your site map is ready to use! That’s so simple, right?
This has been tested and working good in PS Auto Sitemap version 1.1.3 and qTranslate version 2.4.3.
Print This Post
thanks a lot. these are things I need. simple and easily
Thanks for the fix bud – but there i’m still having an issue (perhaps its only with my wp install)
I added the revised code above and it did remove the ‘language string’ around the links but I can’t get the sitemap to be fully multilingual.
Whatever language I choose it displays the exact same english sitemap!
Any ideas?
@Bobby
UPDATE from previous post:
Problem: Only ONE language sitemap page would display regardless of what language was selected
SOLUTION: Noticed that the right language ’sitemap’ page would eventually display (after a few navigation changes) so quickly reasoned that it had to be a ‘cache’ issue – sure enough, went back to the admin section for PS Auto Sitemap and noticed that I had selected ‘use cache’. Deselected that option and everything works beautifully!
Once again, thanks for the great fix!
@Bobby
You’re welcome, and thanks for confirming us about it.
Thank you! I patch code and sitemap work ok.
@LiveStalker
You’re welcome. Glad to know good news from you.
do you know the fix for qtranslate and twitme?
@AstroGirl
What’s the URL of that twitme plugin?