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

Last updated by Carlos Rojas 11 months, 1 week ago.

Assigned support staff: Carlos Rojas.

Author Posts
October 12, 2019 at 6:07 am #4742269

alexanderA

On my page (hidden link), in the footer I have added a multilingual text widget. In that widget I have displayed a Facebook logo, which links to URL A. However, on one particular page of my site (page ID: 555) I would like this logo to link to a different URL (URL B). What is the best approach to implement that? I am comfortable adding custom PHP/JS code.

* Is there a function/filter hook I can use to filter/modify this multilingual text content, on this one particular page?

* If not, as a fall back solution, I guess I could use custom JavaScript to change the URL on that page.

The HTML content of that element can be seen here(https://pastebin.com/XSQMCVaX).

Thanks in advance.

October 14, 2019 at 11:49 am #4749583

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hello,
Thank you for contacting WPML support.

Please visit this link where you will find WPML's hook list: https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

Kind regards,
Carlos

October 14, 2019 at 12:02 pm #4749635

alexanderA

Yes, there are perhaps 100 hooks on that page. Are you able to tell me which specific hook(s) I need to achieve my goal?

October 14, 2019 at 12:31 pm #4749801

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi,

I checked the hook list and I didn't find any specific function that solves your issue. It seems -unfortunately- that for now you need custom programming work which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

Before doing so please have a look also here:
http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

You will get the custom assistance you need to get on with your project.

Regards,
Carlos

October 14, 2019 at 12:54 pm #4750175

alexanderA

OK thanks for checking that.

>> At this point I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

Well I'm a developer, and can perhaps handle this myself.

As a fallback solution, I could just add a couple lines of custom JavaScript to the page and call it a day.

But what if I wanted to implement a purely PHP solution--how might I approach it in this way? In the worst case, I can perhaps use `the_content` filter hook. But doesn't that fire on each and every post? If so, that may be overkill, or obtrusive.

Is there perhaps a WordPress core filter hook that fires whenever widget content is rendered? If so, that might be an option.

October 14, 2019 at 1:20 pm #4750579

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi there,

I'm thinking that maybe you could add the conditional in the theme, for instance, you could ask if the page ID is 555 and then load a JS that changed the link of the Facebook icon.

In any case I recommend you to contact the WordPress support service and ask them about this scenario because, as mentioned before, it falls outside of our scope and I don't want to suggest you something that might be wrong.

Thank you very much for your understanding.
Regards,
Carlos

October 14, 2019 at 2:04 pm #4750789

alexanderA

> I'm thinking that maybe you could add the conditional in the theme, for instance, you could ask if the page ID is 555 and then load a JS that changed the link of the Facebook icon.

Right. That's the solution I had in-mind when I mentioned I could add JS and call it a day. This is probably the easiest solution, and will be fairly robust. Out of curiosity though, I was just wondering if there was perhaps a pure PHP solution I was overlooking.

October 14, 2019 at 3:39 pm #4751649

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi,

Maybe this could give you an idea:
- hidden link
- https://wordpress.org/plugins/conditional-widgets/

Regards,
Carlos

October 15, 2019 at 5:28 am #4754477

alexanderA

OK thanks for that. I probably should have mentioned that I know how to do this with a plugin, and was looking to avoid that. But the link you gave, "How to Show or Hide Widgets on Specific Pages in WordPress," is interesting. I'll probably stick with the JS solution, but it's interesting to know that exists.

We can consider this resolved.

October 15, 2019 at 9:28 am #4755807

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi there,

I'm glad to hear that the issue is solved 🙂

Please don't hesitate to contact us if you need our help in the future with WPML. We will be more than happy to help.
Best regards,
Carlos