Changing the url of the logo on Woocommerce pages

Posted in: Newspaper
Post count: 200

Hi guys,

I’d like to change the url of the logo (on desktop and mobile) on woocommerce pages (incl. cart and checkout pages). Is that possible? It’s a pretty clickable object and I don’t want to mislead visitors to think that they’ll land on the shop’s homepage when they click on it, but land on the site(magazine)’s home page instead.

Thanks

Post count: 20688

Hi,

That would require modifications to the logo files. The default URL is the home address.
Try making the change in this file like this
https://www.screencast.com/t/rFbgDqeC

Thanks

Post count: 200

Hi,

No success. The site and shop are in Cyrillic and the url structure is in Cyrillic too, so I tried with /shop/ , as you suggested, and with the word in Cyrillic /магазин/
The logo still always leads to the home page of the site.

Post count: 20688

Hi,

Try making the modifications in these files, as shown in the screenshot (you can use the conditions from the other modifications) in all the shown locations
https://www.screencast.com/t/2j4l0XKI
https://www.screencast.com/t/lVc2ioyacV
Use the shop word in your language as well, I forgot to mention that. It should work properly, it is working in my tests.

That

Post count: 200

It’s not working on my side. I have both files in my child theme. I edited both files as follows:

View post on imgur.com

But nothing changes. The logo on woocommerce, cart and check out pages still points to the home page of the site, not to the shop home page (www.domain.com/магазин/)

Post count: 200

Sorry, I can’t paste my code here to show

Post count: 200

…if retina…
<?php echo esc_url(home_url( ‘/’ )); ?>”>

…not retina…
if (is_woocommerce() or is_cart() or is_checkout()) { echo esc_url(home_url( ‘/магазин/’ )); } else {echo esc_url(home_url( ‘/’ ));}; ?>

  • This reply was modified 8 years by DaveS.
Post count: 20688

Hi,

Make the modification in all 4 cases in both files as instructed and it should work. This is a product page and I have made the mentioned modifications in the child theme as well
https://www.screencast.com/t/HjQlbqSdBy
The logo redirects to the shop page. Clear all caching after making the modifications.

Thanks

Post count: 200

Hey,

I changed the code for retina and not retina in the file logo.php – nothing changed in the front.
Then after editing the code for retina in the file logo-h1.php – the logo disappears from both – the site and the shop.
I never see a link to the shop when hovering the logo while visible.

Post count: 22421

Hello,

Since this represents customization we will not be able to help you with the exact code you need to implement to make the modification correct. Sorry but we do not have a customization department. Simion provided the exact files you need to edit and mentioned how to do it.
Try to first make a back-up of those files and try to edit them in the main theme not in the child theme. Maybe your child theme is jot set up properly. Make sure you clear all caching after you modify the files.

If you do not know the correct syntax to modify the code we recommend hiring a freelancer from sites like studio.envato.com.

Thank you!

Post count: 200

Hi Bogdan and Simion,

I followed the steps exactly as described by Simion, but for some reason now nothing changes.

Here are both files:

https://www.dropbox.com/sh/6ok6oj1sh5s7vur/AAAS4ZSdT9TOW-EvEqD65Bysa?dl=0

Unfortunately the url of the logo doesn’t change.

I tried to use them in the child and in the main theme – no result.

I would appreciate you if you take a minute and have a look, maybe I have a typo somewhere…

I really enormously appreciate your constant support with solving all our issues so far, thank you!

Post count: 20688

Hi,

It seems you are missing the closing tag and a double quote
https://www.screencast.com/t/AGIlilgXW
Try adding that as shown and it should work properly
https://www.screencast.com/t/fo5gCMvxD7
Double check the code and compare it to the screenshots provided and wit will work as intended.

Thanks

Post count: 200

I did it, added the closing tag and a double quote to all 4 places (in both files in my child theme; the files have rights 644), tested in Chrome and Firefox incognito mode – no change…

I realized that I had the files in folder newspaper-child/parts/ and moved them to the folder newspaper-child/parts/header/

What changed – the logo on all shop pages finally got a new url assigned, but it leads to 404 page.

The url looks like this http://www.domain.com//�������/

Post count: 20688

Hi,

That is unusual. I could not say why it is displaying like that, for me that does not happen in my tests
https://www.screencast.com/t/fo5gCMvxD7
I have no solution for this problem, maybe you can find more answers online as to why these characters are displayed in the URL.

Thanks

Post count: 200

Hi,

when I change the slug from Cyrillic to Latin: магазин -> shop , then the modifications works. But the slug can’t be switched to English/Latin. Could the issue be in the encoding? DO you know of a code that could solve this?

Thank you

Post count: 20688

Hi,

That is what I think, but I could not say what exactly would be the solution. I found some similar topics online
https://wordpress.stackexchange.com/questions/215123/cyrillic-characters-in-rewrite-rules-cause-404-not-found-errors
http://forum.hostek.com/showthread.php?733-WordPress-What-to-do-if-Russian-(Cyrillic)-characters-are-showing-as-question-marks
https://stackoverflow.com/questions/241015/question-mark-characters-displaying-within-text-why-is-this
If you decide to try some of the solutions from these topics please make a full website and database backup before, just to be safe.

Thanks

Post count: 1341

@DaveS, ваш случай лишний раз доказывает, что кириллица в путях сайта – есть зло. И ранжироваться поисковиками сайт может через пень-колоду…

Большой у вас магазин? Может, пока он не разросся, имеет смысл перевести все линки на английский?

Чтобы в будущем не заморачиваться с линками, мы на своих сайтах используем плагин Cyr-To-Lat, он хоть и старенький, но работает с Темой нормально, ошибок не наблюдаем…

https://ru.wordpress.org/plugins/cyr2lat/

Converts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs.

Post count: 200

Hi guys,

all magazine urls, and the shop urls, additionally, are in Cyrillic. I don’t want to change this. I never had any issues with this, so far.

Simion, thanks for your research and advice. I only can understand how to do the SQL command, which is suggested in your second link. However, I get an error before executing the command:
https://www.dropbox.com/s/obzy3nz3cqrorao/demo-1.jpg?dl=0

I made a print screen on the tables in the database where their encoding is visible. Maybe it could help:
https://www.dropbox.com/s/kiem8m5n1m987e1/tables.jpg?dl=0

Simion, one more thing – the suggested above editions change the url of the logo (even not properly), but when I scroll down, the url of the logo in the sticky menu changes back to the default url of the home page of the magazine. I guess there are some more edits needed in order to fix this.

Here are once again both files that were edited:
https://www.dropbox.com/sh/6ok6oj1sh5s7vur/AAAS4ZSdT9TOW-EvEqD65Bysa?dl=0

As always – thanks for your constant support!

Post count: 20688

Hi,

I strongly believe that it is the encoding, but I don’t know what would be the solution. For me it does not happen, the exact characters are displayed properly. I have opened the php file with notepad++ and changed the character encoding, and somewhat managed to replicate the problem. Try opening the file with the same editor and check if the file is encoded like this
https://www.screencast.com/t/AVXS4ABFfTr
There are multiple references to this online, but nothing more specific to the exact solution.
The menu when sticky can use two options for the logo
https://www.screencast.com/t/wNYHxMnt2R
Either the same normal logo or the mobile logo. If the mobile logo is used you will have to make the modification in these files as well
https://www.screencast.com/t/sbHudSnunNr
https://www.screencast.com/t/3TZ6xkHaV8vI

Thanks

Post count: 1341

With notepad++ needed “Encode in UTF-8 without BOM“.

Post count: 200

Hey Simion,
thank you for your patience and time spent helping to successfully solve our issue!
I opened all 4 files with notepad++ and UTF 8 wasn’t checked so I converted them to utf 8, then re-uploaded on the server, and it finally worked!!!
CHeers!

Viewing 21 posts - 1 through 21 (of 21 total)
The forum ‘Newspaper’ is closed to new topics and replies.