Hi, Amit here, I am the WPML Support Manager, our current ticket queue is quite calm and I'd like to encourage you to use our new chat support option

We are working hard to debug and look at every single report

All of the known issues are documented in https://wpml.org/known-issues/ you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

We are also adding once a week a tutorial to our YouTube channel - https://www.youtube.com/c/WPML-multilingual - check out if we already covered what you need and leave us a comment if you want us to produce anything there

If you do need to open a ticket please make sure to provide us with all the needed information as described here https://wpml.org/faq/checklist-before-opening-a-ticket-in-wpml-support/

We are very proud at our level of support, we are one team from all over the world and we are all experienced WordPress developers, you can read more about us here - https://wpml.org/forums/supporters/

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 47 replies, has 3 voices.

Last updated by Andrey 1 year ago.

Assigned support staff: Andrey.

Author Posts
February 7, 2018 at 1:11 pm #1510001

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

I've taken another look. Deactivating WPML on your last test site (I tested this locally too) won't make the custom sidebar appear. If you go to your test site, you'll see that WPML is deactivated and there's still no desired widget.

Despite this fact, I've looked at the child theme and can see you included your custom files. As mentioned before our support is limited to debugging custom solutions. At this point, I'm afraid we cannot help you. It needs to be debugged deeper.

I would also suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/
You will get the custom assistance you need to get on with your project.

Thank you for your understanding.

February 7, 2018 at 1:56 pm #1510080

berryP-2

Andrey, thanks for your reply, but I have to disagree with you a bit. My widget does show/hide when activating WPML. I just tested it several times.

There were some files in there, but they were not called. I only included 1 file (widgets.php) in functions.php which includes widgets/awempire.php. Because otherwise I couldn't show you the widget we were talking about.

There was some other code in that file (widgets.php), but everything was commented out so it was not 'triggered', so I find it a bit weird you say "you included a file and that's why we can't help you". How else could I show you this on a vanilla install ?

There was one echo command in there (1 word) and a banner (which didn't seem to always show). But regardless if the banner showed, the echoed word, should always have showed, whether the banner showed or not and if WPML was active or not.

If you go to the hidden link you see 1 widget in the sidebar with the text "This is some text in a widget which won't show if WPML is activated." can also be seen in screenshot. If you login and activate WPML then the WPML language switcher appears and my widget is gone. Those are the only widgets in the sidebar right now, see screenshot (or login and check it).

To make it even more easier I included that specific widget in functions.php now which is now the only file in the template and it consists of setting up the widget, registering the widget and loading the widget, all in 1 file. The code of this can be found here: https://pastebin.com/kx3gfFRM. The widget code comes straight from the WP codex. Nothing special I would say, yet if WPML is activated, this widget is not shown.

This is a near default WP installation. The only difference with a default installation is this uses a child theme which has 1 file in it and this is a required file. I don't see why this should be considered as "debugging solutions". It's a default installation with only 2 plugins active (which are related to the issue) and 1 default file which is needed to show the issue. So that included file would be the only thing that you would need to look into. And this is according to the WP codex.

Activating/deactiving WPML does trigger show and hiding of my widget like the WPML language chooser which only shows if WPML is active. I have tested it at least 10 times and every time I activate WPML it hides my widget. You can check this for yourself by deactivating the plugin and looking at the sidebar.

So I don't know what to do anymore. The test site clearly shows my widget is not showing in a (near) default installation when you activate WPML. You can test this for yourself.

Now if my site had a lot of custom stuff in it, I would understand you don't want to find the issue, but this is a default installation with 1 simple text widget.

February 8, 2018 at 1:54 pm #1511560

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

Thanks for your explanation and patience. Yes, now I see that widget appears or disappears depending if WPML is active or not.

I reduced further the problem, it turned out that the issue appears even without Timber plugin. I was able to replicate without it.

I'm going to report this to the development team. In the meantime, the followed solution made a trick:

Go to your widget class and add at least empty the other two methods (update and form). After, go to the widget sections, open your widget, choose all language and save. It should appear now.
Your code will look like:

	class awempire extends WP_Widget {

		public function __construct() {
			// Instantiate the parent object
			parent::__construct(
				'awempire',
				'SD8 AWEmpire',
				array(
					'description' => 'AWEmpire ads'
				)
			);
		}

		public function widget( $args, $instance ) {

			echo $args['before_widget'];
			echo '<p>This is some text in a widget which won\'t show if WPML is activated.</p>';
			echo $args['after_widget'];
		}
		
		function update( $new_instance, $old_instance ) {
		// Save widget options
		}

		function form( $instance ) {
			// Output admin widget options form
		}
	}

	function sd_register_widgets() {
		register_widget( 'awempire' );
	}
	add_action( 'widgets_init', 'sd_register_widgets' );

I didn't make this changes on your test site, as FTP access doesn't work for me. It says incorrect login.

I hope this helps.

February 8, 2018 at 1:58 pm #1511563

berryP-2

Thank you Andrey, I am a bit relieved to be honest... I was actually beginning to doubt myself.

In all honesty I didn't think there was going to be a fix for this. Because of this about 1 hour ago I asked for my refund. Can you please cancel that for now ? Because if this fix is working, then I prefer to keep using WPML.

Weird the FTP didn't work, but I can make these changes myself of course.

Can you share some intel about why the empty functions need to be there ?

February 8, 2018 at 2:34 pm #1511612

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

Thanks, I'll send email to the management team.

I'm not able to say why exactly (this needs to checked deeply) but I guess WPML checks not only an output of the widget itself. Probably, you can try to remove them right after; you resave the needed widget.
I will keep this ticket on our record, and when I've got more news if this is going to be improved in future, I let you know here. But this should not make any influence for WPML work on your site in future.

February 8, 2018 at 2:35 pm #1511613

berryP-2

I have removed DISALLOW FILE EDITING, so you can now edit the files in the admin/editor.

I have just changed it on the url I gave you and also on my local but I can't make them 'appear' yet.
I can add the widgets but the save button, keeps on spinning.

February 8, 2018 at 2:42 pm #1511623

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

Deactivate WPML, add the widget, activate and then resave. Does this work?

February 8, 2018 at 2:44 pm #1511625

berryP-2

With or without removing all WPML settings ?

February 8, 2018 at 2:49 pm #1511632

berryP-2

I have tried various 'orders', nothing worked.

I have just changed it on the url I gave you and also on my local but I can't make them 'appear' yet.
I added a return ($old_instance) to the update function otherwise the save button kept showing a spinner.

I did remove DISALLOW FILE EDITING, so you should be able to edit the files in the admin/editor.

Could you make them appear on the sandbox ? I want to believe you have found the fix but I can't reproduce it yet.

February 8, 2018 at 3:25 pm #1511739

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

You would just need to trigger the language dropdown and save. Check it now.

February 8, 2018 at 3:41 pm #1511765

berryP-2

AAAAH ok, that was the one step I missed...

I now changed it to English, saved, then changed it back to all languages and saved again.

Now it appears to finally shows the widgets on places where they should 🙂

Finally... I had really given up on it already. Thanks for this... It annoyed me so much that I couldn't find the problem.

I'll leave this topic open, just in case... I'm gonna focus the rest of the day on checking things and if everything is working as expected on other places. I'll close it when it all returns ok.

February 8, 2018 at 3:44 pm #1511774

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

Thank you for your patience. I glad to hear it also works for you 🙂

February 8, 2018 at 8:05 pm #1512088

berryP-2

Do you think it is possible to save/set the "All languages" option when the widget is added ? So I don't have to save 2x ?

February 9, 2018 at 7:53 am #1512393

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kiev (GMT+02:00)

Yes, I think it is possible. On your staging site I saved the "All languages" option.

February 9, 2018 at 1:09 pm #1512820

berryP-2

Do you also have an idea how to set this ? I know how to set a default widget title but if I do this I wanna make sure I save it right 😉