WPML issues with custom homepage layouts
-
CreatorTopic
-
December 21, 2012 at 1:26 pm #1656
tox
MemberSince updating to WP 3.5 things have been a bit shaky on my site. First I could not view the post without turning off WPML-bridge. This was fixed with the latest WPML update (yesterday). Now, the Custom Homepage Layouts do not work properly. I am only able to select ONE Custom Layout under Appearance/Theme Options, and this Custom Layout will then show on all languages. When I change language and select another Custom Layout the new selection will show on all languages. Please give me some advice.
-
CreatorTopic
-
AuthorReplies
-
December 21, 2012 at 8:05 pm #1668
Jason Bobich
KeymasterThe first issue was because of a bug in WPML and WP 3.5 which I actually pointed out to the them.
http://wpml.org/forums/topic/calling-icl_get_languages-with-wp-3-5-and-resetting-query
On this second issue you’re describing, did it happen with the latest WPML v2.6.3 update? Or was it happening with v2.6.2 also?
December 21, 2012 at 9:02 pm #1671tox
MemberIt happened after the v2.6.3 update.
December 21, 2012 at 11:40 pm #1675Jason Bobich
KeymasterOk, so I’ve made appropriate updates to the WPML Bridge plugin to accommodate this issue with WPML v2.6.3:
https://github.com/themeblvd/Theme-Blvd-WPML-Bridge/commit/7c7b2603852374e88cfbc318de6b7ae7e1017a2f
And I’ve let WPML know about the issue:
http://wpml.org/forums/topic/calling-icl_get_languages-with-wp-3-5-and-resetting-query/#post-92745
I’ve updated WPML Bridge plugin to v1.1.1, which should you be able to update shortly to through your WordPress admin.
Let me know if you continue to have issues.
December 22, 2012 at 2:13 am #1677tox
MemberThank you for your expediency but I am sorry to say that it still does not work. I have updated to the new version of WPML Bridge (1.1.1) and just as before; I can only set ONE Custom Layout that becomes the selection for ALL languages.
December 22, 2012 at 10:01 pm #1684Jason Bobich
KeymasterThe problem before seemed pretty straightforward. WPML’s function for pulling languages no longer works in the admin panel. So I changed to something else and now it pulls the languages from WPML. I’ve got everything working 100% on my end, as far as I can tell.
Does your Theme Options page not look like mine with your active languages listed at the top? Or am I misunderstanding the issue?
In the above screenshot, I’m using:
- WordPress 3.5.0
- Swagger v1.1.5
- WPML v2.6.3
- Theme Blvd WPML Bridge v1.1.1
December 23, 2012 at 3:04 am #1695tox
MemberThank you Jason! Now the Custom Layouts work.
But instead all languages do not show for all pages on the user end and some posts that are scheduled to be published later are showing in German and Swedish, which is incorrect. In English the posts scheduled for later publication are not showing (i.e. correct function). All this was working well before I updated to WP 3.5 and WPML v2.6.3. My Swagger is version 1.1.5 and WPML Bridge is v1.1.1.
December 23, 2012 at 10:17 pm #1719Jason Bobich
KeymasterI’m not totally sure what any of these issues would have to do with my plugin. Unless there’s some kind of weird conflict, nothing in the WPML Bridge plugin should effect these things you’re describing.
Have you tried posting in the WPML support forum? These sound like some general issues with WPML. I honestly just don’t have the expertise on WPML to troubleshoot these kinds of issues.
December 24, 2012 at 12:58 pm #1726tox
MemberThank you for your reply. I have emailed log in details to the WPML team and they are looking at it now.
January 11, 2013 at 7:03 pm #2429tox
MemberDear Jason, I have asked Piet Bos from Senlin Online http://senlinonline.com/ to help me sort out my problems. I have given him access to my account. He will probably try to contact you tomorrow. Please assist him. Warmest, Torkel
January 12, 2013 at 2:03 am #2454tox
MemberDear Jason, this is Piet using Torkels login details as he mentioned above. I am helping him to get WPML to work correct on his website. Nice to meet you.
The problems I have so far discovered are the following:
1a. the custom layouts per language seem to work well, BUT when choosing the Post List element then the Categories of English (default language) show up for both German and Swedish (the secondary languages).
I have made a screenshot available at: http://db.tt/IRNzyqKH1b. when using the WPML backend language switcher to change the language to for example German, then the same happens as above, but for all languages, so the in English it is impossible to choose the correct English category.
2. the WPML frontend language switcher does not point to the correct content of the other languages. For example when I am on a Page, the WPML language switcher points to a category.
I have been working with WPML since its inception and I have never come across this behaviour.
Is there anything else you need from me?
January 12, 2013 at 2:28 am #2456Jason Bobich
KeymasterBut instead all languages do not show for all pages on the user end and some posts that are scheduled to be published later are showing in German and Swedish, which is incorrect. In English the posts scheduled for later publication are not showing (i.e. correct function).
Ok, so we’re on to completely new issues now? And we’re not talking about this any more (above quote)?
I will look into these things tomorrow.
2. the WPML frontend language switcher does not point to the correct content of the other languages. For example when I am on a Page, the WPML language switcher points to a category.
But can you first expand on this a little? I’m not quite sure I understand the issue or what context you mean on the website. Can you show me a live link or a screenshot? Are you referring to a WPML-built language switcher or one from my plugin? This happens on all pages? Languages switchers point to categories opposed to translated content of whatever page?
January 12, 2013 at 5:48 am #2459tox
MemberHi Jason, thanks for your reply.
The above is also still an issue, the theme does not respect scheduled posts (to be published at a date in the future) for the secondary languages. The only way to solve that is to make drafts of the posts, but within Torkel’s user scenario that completely defeats the purpose and brings a lot of extra work for him.
I actually have tested this on one of my own site setups and it works as it should, so perhaps there is something in the Swagger theme or in your theme-blvd-wpml-bridge plugin that does not check whether a published post has a future date (post_status=future)?Regarding my 2nd point (can I assume that you can confirm my 1st point?):
The default WPML language switcher is set to show on the right sidebar and the problem only manifests itself on the Chapters page, which uses a Custom Layout that calls a post list from the chapters category (again with issue 1 as per my previous post).When you have a look at the Chapters Page: http://www.onthisday80yearsago.com/the-chapters/, please have a look at where the links of the language switcher point to. This should be the German equivalent of that page (http://www.onthisday80yearsago.com/de/kapiteluebersicht/), however instead it points to the German chapters category page (http://www.onthisday80yearsago.com/de/category/die-kapitel/). Usually the only time when this happens, is when page-slug and category-slug are exactly the same. However in this case the slugs are completely different, so I am unclear as to where this is coming from.
I am inclined to physically add the language switcher to the sidebar (i.e. hard code it in the template files), but as I don’t know your theme I am not sure from where the sidebars are called. I found swagger/framework/api/sidebars.php; would it be possible to hook into that function from the functions file of the child theme?
January 12, 2013 at 6:22 am #2460tox
MemberFollowup: I manually added do_action(‘icl_language_selector’); to swagger/framework/functions/display.php and that unfortunately had the exact same result: linking to the category instead of the correct page.
January 13, 2013 at 1:44 am #2470tox
MemberHi Jason,
Piet here again. Do you have any news for us regarding the issues above?
Please let me know, because if you cannot help Torkel further then we need to switch to plan B.
Thanks,
PietJanuary 13, 2013 at 2:55 am #2471Jason Bobich
KeymasterAll right, so I’m going to do my best to address these issues in an order that makes sense with solutions for the various items sort of going together. All issues that I’m trying to reproduce and find solutions for are being done on my live server here (opposed to locally as I normally would): http://themeblvd.com/demo/wpml — Using Swagger v1.1.5, WPML v2.6.3, Theme Blvd WPML Bridge v1.1.1, WordPress v3.5
WPML Bridge Plugin
Keep in mind that my WPML Bridge plugin really doesn’t do a whole lot in modifying anything that has to do with WPML. The bulk of it essentially just uses WPML languages to designate a Theme Options page for each language. And then on the front-end of the site, it gives you some custom flag switchers you can use completely separate from WPML’s default switchers.
Language switcher behavior
2. The WPML frontend language switcher does not point to the correct content of the other languages. For example when I am on a Page, the WPML language switcher points to a category.
I can confirm this happens on my end, as well. The reason is because the theme uses
query_posts()
on paginated post lists and paginated post grids and then does not usewp_reset_query()
afterwards as it should. This causes issues for WPML. This is something that was addressed and fixed a while back for the next update (which doesn’t help you at the moment).For example, in your case, we use
query_posts('category_name=whatever')
, and now WPML thinks we’re on a category archive page when it gets to rendering the switcher.Let’s first discuss options for this Chapters page and then get to a solution to the issue of the switcher. — I noticed you guys have a custom layout with a paginated post list setup. First off, out of the three ways you could have constructed this page, it’s probably the least efficient way in terms of resources it’s going to take to load. I know you, Piet, have never used my themes, so I just want you to be aware of your options here to accomplish a page displaying a paginated post list. Here are your ways in order with #1 being the most efficient.
- Category Archives: Link directly to the WordPress category archive page. — In doing this, there’s no
query_posts
, so you shouldn’t have any issues with the WPML language switcher widget. - Post List page template: Create a page and apply the “Post List” page template. This is what I’ve done on my demo site’s “Blog” page. On each language variation of that page I added a custom field called “category_name” with value of the slug that language’s “blog” category. See here for custom fields you can use with the page template.
- Custom Layout: Create a custom layout and a put a paginated post list element in it. Apply that custom layout to a static page.
And from your Child theme’s functions.php here is how you can reset query_posts to fix the language switcher issue with #2 and #3. Let me know if this doesn’t work. — It’s a little hacky and won’t be needed in Swagger v1.2, but basically we’re just hooking into the sidebar function before the actual sidebar does to reset the query.
add_action( 'themeblvd_sidebars', 'wp_reset_query', 9 );
Selecting categories in custom layout.
1b. when using the WPML backend language switcher to change the language to for example German, then the same happens as above, but for all languages, so the in English it is impossible to choose the correct English category.
This is actually not the case for me. See screenshot: http://www.uploadblvd.com/uploads/image_50f215452320e.png
However, either way, I will admit this is probably not ideal with working with WPML because you’d have to ensure that you never opened and saved a layout of one language while under another language. This could get messy in the long run.
1a. the custom layouts per language seem to work well, BUT when choosing the Post List element then the Categories of English (default language) show up for both German and Swedish (the secondary languages).
Keep in mind that creating these different custom layouts is not built around WPML in any way. We’re just using the WPML Bridge plugin to take this layout system and then be able to apply it to different languages from the Theme Options page.
So a workaround here would be to use the “Custom Query” option when editing your custom layouts’ Post List elements. When you put anything in the custom query option it will override any of the other query-type user options before it. So basically by going to each language and manually putting in a call to the category for that language, you’ll be ensuring that the user can’t open up that layout from the wrong language and unintentionally mess up the category selections.
Future scheduled posts
The theme does not respect scheduled posts (to be published at a date in the future) for the secondary languages.
Honestly, this in itself doesn’t quite make sense, as when you execute any query, this should already be the case by default. In other words, you shouldn’t ever have to factor into your query to exclude future posts. This is default state of any query from the beginning. I can only think there’s something specific about your site that you could possibly be overlooking? Maybe some kind of other plugin that does something with scheduled posts?
Maybe you can play around a little more with this with the different ways of setting up these content the theme offers that I’ve explained and see if you can narrow down how this issue arises? Here’s what I’ve done to try and reproduce the issue and everything is working for me.
- I have a category called “portfolio” of posts. Every post has been translated into English, French, and German, and applied to its corresponding “portfolio” category of its given language.
- I’ve setup a static page with a Post List page template applied. I’ve created a version of this page in English, French, and German.
- For each language version of this page, I’ve include the corresponding category of posts by adding a custom field called “category_name” with the value of the category slug for each. See screenshot.
- I created a post called “Future Post” translated into all languages, in which I scheduled to be published next year.
Here’s a screenshot of how all of these included posts are setup for my “Portfolio” category: http://www.uploadblvd.com/uploads/image_50f221de795be.png
English: http://themeblvd.com/demo/wpml/post-list/
French: http://themeblvd.com/demo/wpml/post-list/?lang=fr
German: http://themeblvd.com/demo/wpml/post-list/?lang=deYou can see that on none of the languages show the “Future Post” at the top.
Note: Just a random tidbit, on these pages I’m linking to with the Post List, you’ll notice that the WPML Language Selector widget in the sidebar does work, and that is only because I’ve applied the fix mentioned previously.
-
AuthorReplies
- The forum ‘Swagger Responsive WordPress Theme’ is closed to new topics and replies.