Change all our news link


I am using the latest news widget on the homepage and I would like the ‘See all our news’ link to go to my own blog page. I found the code on this page here and it works great. I changed the link to /blog. However, I am using the Moesia Pro theme together with WPML Multilanguage. This works good too, but the link in my two languages go to the same custom link.

Is it possible to change the code so that when the English language is selected, it will redirect to a different link, so to ‘/en/blog’?

Thanks in advance.
Regards, Victoria

Hello Victoria,

Can you please provide a link to your website?

Kind Regards, Roman.

Hello Roman,

Here is the link to my website.

If you scroll down to the news area, the link goes to the correct page my blog page. That is because I used the code from the link mentioned in my previous post. However, it does the same when you click on the English flag: it goes to the same link, which in this case is the Dutch blog post.

So I am wondering if there’s a way to make the code detect the language (or the use of /en/ in the url) and then redirect to a different link which would be site/en/blog.

The site is under construction. So please use this to login:

  • [hidden]
  • [hidden]

Thank in advance.

Kind regards,

Hello Victoria,

I still can’t see your front page with that account, unfortunately.

However, you can try to use the following CSS code in order to hide (not remove) default Moesia FP: Latest News widget button (then you will be able to add SiteOrigin Button widget into the row that contains Moesia FP: Latest News widget to display different buttons on different pages).

You can add CSS code in Customize → Additional CSS section.

section.latest-news-area a.all-news {
    display: none;

Kind Regards, Roman.

Hello Roman,

That’s weird, it should work.

I know I could hide the button and then use a separate button in place. The reason I asked, is because I was looking for a javascript option. Sadly my knowledge of javascript is very limited.

I’ve kept the javascript code to change the normal page link and I used this code to hide the button on the english version only:

.page-id-498 section.latest-news-area a.all-news { display: none; }

On the homepage, I used the editor widget (instead of the button widget) to create a button, using the CSS from the template. This way the button shows up exactly the same way that the original button did.
<p style="text-align: center;"><a class="all-news" href="../en/blog">See All</a></p>

This works perfectly. I thought that a javascript option would be prettier, but it works.

Thanks for your assistance.
Kind regards,

Okay, you are welcome Victoria.

Please feel free to ask any other questions that you might have in future.

Kind Regards, Roman.

1 Like