Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 14 replies, has 3 voices.

Last updated by sebastienL-23 2 years, 10 months ago.

Assigned support staff: Sumit.

Author Posts
August 17, 2017 at 4:02 pm #1345465

sebastienL-23

Hi everyone !

Your plugin is awesome, and even if I had a hard time understanding the basics, I'm starting to get a bit more comfortable using it.
I have a couple of issues though. Here they are (would separated topics have been better ? I thought that if these probleme where somehow related, you would've wanted to know about them altogether) :

1 - Given the problems with Yoast SEO breadcrumbs, I switched to the breadcrumbs included in WPML CMS Nav. But as you cannot use it within the loop (https://wpml.org/forums/topic/icl_navigation_breadcrumb-causes-endless-page-loading/), I don't have any breadcrumbs on my custom posts. Is there a way around that ?

2 - The site I'm working on uses 2 custom post types ("products" is one of them), created with the CPT UI plugin. I activated the translations for the custom post types & taxonomies (which are product categories & stockists types) and translated them. I then synchronised the menus.

What I have on the website basic language (French) : hidden link
What should work : hidden link
What actually works : hidden link
What the menus (both WP menu and WPML language selector) does : hidden link

That's a weird mix, and I wish I could get rid of the useless /famille/ (but this might come from CPT UI)

I already tried to re-save the permalinks, to no avail.
I use a custom theme, child of twenty-sixteen, and translate from French to EN (ES, DE, IT, PT, NL will come later). The website can be seen here : hidden link

Any help would be very welcome !

August 17, 2017 at 8:18 pm #1345660

Bruno

Hi,

Thank you for contacting us.

On the first problem, you can use the icl_navigation_breadcrumb action of the loop (for example, before the loop). Example:

// single.php file

	do_action('icl_navigation_breadcrumb');
			
	/* Start the Loop */
	while ( have_posts() ) : the_post();
...

Following these steps, the breadcrumb should be displayed correctly on the singles.php pages.

About the second question, may I kindly ask you please to open a new ticket for your new question? This will also help other users with similar problems find solutions when searching the forum.

Please, could you test and verify if the problem with the breadcrumbs persists?

Thank you.

August 18, 2017 at 7:04 am #1345844

sebastienL-23

Hi Bruno, thanks for your reply.

I added the code where you told, it works. I was trying to put it within the template-part php file in my theme, where it should have been in the single-cpt.php file like you said.

But the path is Home > ref. product, where it should be Home > products > product category > ref product. Is this normal ?

I'm going to open a new ticket for the second question.

Thank you

August 18, 2017 at 8:01 pm #1346360

Bruno

Hi,

Yes. This does not seem to be returning the breadcrumb of custom post type, just the CPT posts title. I'll check this with 2nd tier support and soon I'll contact you.

Thank you.

August 31, 2017 at 2:39 pm #1355286

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I am Sumit from 2nd tier support team!

No this is not normal! It is a bug which we have escalated to developers!
Once it is fixed it will be like
Home > Post type Archive link > Single post name

If post type do not have archive then it will use taxonomy so it will be like
Home > Any Category/taxonomy link > Single post name

I will inform you once it will be fixed. If it is urgent for you and you need a workaround for that then please let me know!

Thanks

September 4, 2017 at 6:28 am #1356885

sebastienL-23

Hi Sumit,

thanks for your reply.
It's becoming a bit urgent yes, so if there is a (not too complicated) workaround, I would love to know 🙂

September 4, 2017 at 1:40 pm #1357907

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Please make a backup of site files and database and update all plugins as we have released a new update today! (Backup is just a good practice!)
Then go to file \wp-content\plugins\wpml-cms-nav\inc\cms-navigation.class.php line number 266
you will see the code

}elseif(($post_type) && get_query_var($post_type)){

Replace it with

}elseif(($post_type) && is_singular($post_type)){

That's all you have to do! If you need my help making these changes just let me know!

Thanks

September 6, 2017 at 7:42 am #1361218

sebastienL-23

Hi Sumit,

Thanks for your reply,
we've updated the plugin, and changed the bit of code. There is a progress, but it still doesn't work as we need : although we don't have an archive page for the post type, the breadcrumbs is still
Home > Post type Archive link > Single post name

and not
Home > Any Category/taxonomy link > Single post name

Besides, the Post type archive link is not translated by the way, but as it will hopefuly be replaced by the taxonomy link, it's not the main concern.

Is there maybe another modification we have to do in the code for this to work ?

September 7, 2017 at 8:42 am #1363192

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I understand the problem! but I need to be sure that if it is the same problem as I think.
Can you please confirm if your post type has has_archive set to false?
Ref: https://codex.wordpress.org/Function_Reference/register_post_type#has_archive

1. If you register this post type using some plugin/theme you will find this in post type settings.
2. If it comes with theme/plugin you can ask to plugin/theme support about this parameter value.
3. If you register it yourself then I guess you know where to find it!

The archive should be set to false in order to show the term archive link.

Thanks

September 8, 2017 at 6:47 am #1364494

sebastienL-23

Hi Sumit,

Thanks for your reply.
I've found this setting in the plugin CPT UI, and turned it to false, but unfortunately there is no change...
We have another thread opened on this forum here https://wpml.org/forums/topic/menus-links-and-url-problems-with-custom-post-types/#post-1361255
Maybe the two problems are linked ?

September 11, 2017 at 9:37 am #1367090

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Sorry for the delayed reply!
I have forwarded this case to our development team! I will let you know once I get the feedback!

Meanwhile, I have adjusted more code to make it work you can download the file from here hidden link
#1 First download the file and make backup of WPML CMS Nave plugin
#2 Go to \wp-content\plugins\wpml-cms-nav\inc and replace it with cms-navigation.class.php
#3 Make sure in CPT setting has_archive set to false!

Thanks

September 12, 2017 at 6:40 am #1368213

sebastienL-23

Hi Sumit,

thanks for your reply.
It didn't work though... Should I restore the file cms-navigation.class.php to its previous state ?

September 12, 2017 at 2:40 pm #1368932

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

It should work. I have tested it. Did you clear cache if you have any?
If everything is okay then can you please provide me login details to check else you can wait for the official fix.
If you want me to check, please let me know the CPT name.
You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Instructions to send private information are here: hidden link

Privacy and Security when Providing Debug Information for Support:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Thanks

September 18, 2017 at 10:20 am #1374946

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

Thanks for the details!
In post type settings has_archive was not set to false it was set to archive-produits.php which means "true" even you selected false.
I just removed this value and saved as blank now it works.
Please check the screenshot.

Apart from WPML in CPT UI plugin, it seems to me usability problem when you have selected false it should ignore the saved value. So if in future user change the mind they don't need to fill the same value again. If you wish you can report to the plugin author.

Thanks

September 18, 2017 at 12:21 pm #1375161

sebastienL-23

Hi Sumit,

Thank you very much ! It works perfectly now.
I'll report that bug to the CPT UI plugin author as you suggest.

Thanks again, have a nice day !