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 4 replies, has 2 voices.

Last updated by Shekhar Bhandari 3 months ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
July 19, 2019 at 7:55 am

markantN

I am trying to: use a plugin that makes different post-types and sorts them out with shortcodes

Link to a page where the issue can be seen: hidden link

I expected to see: Below each headline on that page there's supposed to be a lot of different menu items (this is a restaurant site)

Instead, I got: The shortcodes are just not displaying anything. But they are displaying normally when wpml is deactivated.

Uploaded screenshot shows how it's supposed to look. If you go to the link you can see how it looks when the plugin is activated.

July 19, 2019 at 8:26 am #4244885

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Welcome to WPML support. I'd be assisting you further on this issue.

Are you talking about this shortcodes?

[mp_category_list post_type="lunsj-meny" fields="navn,pris,beskrivelse_norsk,beskrivelse_engelsk,allergener," order="asc"]

Which plugin is creating this, and what are the fields as shown in the shortcode, is it a post tag?

Look forward to your reply.

Thanks

July 22, 2019 at 8:41 am #4254929

markantN

Hi. Sorry for late reply.

It's a plugin called "markant portfolio". The fields are what the shortcode is displaying - it's basically just custom text fields. I unfortunately don't know how to explain it further than that. I gave you the login, so if you want you can go to the "post-typer" (post-types) in the control panel and see how they are called out.

I have tried to make these post-types non-translateable and tried every possible combination of options in the wpml settings, but it won't seem to work. 🙁

July 22, 2019 at 12:25 pm #4257133

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

It looks like a compatibility issue with the plugins, to further debug this issue, I would need to replicate your site on my localhost and perform further debugging, so, could you please provide me a backup of your site so I can replicate your site on my localhost and perform further debugging.

To send a backup file you can use backups plugins, or use hosting services back up and send it using google drive, dropbox, etc to us. If you can, I request you to remove the uploads folder from the backup as it will be easy to download due to the size.

I have enabled the private reply so you can send those links in the private reply. If you use some backup plugins installed and you created the packages, you can just provide login details and mention us, we can download it from the site itself.
hidden link

Look forward to your reply.

Thanks

July 22, 2019 at 3:53 pm
July 23, 2019 at 2:16 am #4262095

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

I was debugging the issue and when I enabled/disabled the plugins the custom post type are not showing anymore on the backend so could you please check why it's not appearing?

Also, The plugin "Markant Portfolio" has added some filters to make it WPML compatible and I can see it's creating the issue. On file mrk-portfolio/public/templates/shortcodes/mp_category_list.php the following code is added

// Support WPML ( but not enforce it ).
        if (function_exists('wpml_get_language_information')) {
            global $sitepress; 
            $check = wpml_get_language_information( $post->ID );
			
            $post_language_code = substr( $check['locale'], 0, 2 );
		
            $showPost = $post_language_code == $sitepress->get_current_language();
        }

In this code, the $post_language_code is returning locale where the $sitepress->get_current_language() is returning language code creating conflicts. So to fix the issue, you should replace the

$post_language_code = substr( $check['locale'], 0, 2 );

With

$post_language_code = $check['language_code'];

Please share this with the plugin developer and review these changes.

Also, mark the post types as translatable and translate the custom fields and see if this helps. If this doesn't help, I would request you to ask the plugin developer where the posts is retrieved for mp_category shortcode so I can help you further.

Look forward to your reply.

Thanks

The topic ‘[Closed] a plugin's shortcode is not working’ is closed to new replies.