How to change logo link for Particular page

Hello Developers, Greetings of the day!!

Today I am going to show you how to change logo link for Particular page?

Sometime based on different requirements there is necessity to show different logo link for particular page based on languages. so please follow my below code.

So, for this please add below code in your current wordpress theme’s functions.php file.

<?php function change_logo_link(){?>
<script type="text/javascript">
(function($){
  function change_logo_link() {
    jQuery(".uniqueclassorid .header").find(".logo a").attr("href", "/chnage-link-url/");
	change_logo_link();
})(jQuery);
</script>
<?php 
}
add_action('wp_footer', 'change_logo_link'); ?>

if you want to change logo link based on languages. so please use below code inside the function.

jQuery(".uniqueclassorid .header:lang(es)").find(".logo a").attr("href", "/languvage-code/chnage-link-url/");

The :lang() selector is used to select elements with a lang attribute with the specified value. ex. :lang(es) is a lang selector for the Spanish

I hope this blog might be useful to you.

Thank You 🙂

Blog Catagory : jQuery , PHP , WORDPRESS