 
	
		
		
		
		
			
- 
		AuthorPosts
- 
		
			
				
March 24, 2017 at 12:59 am #765814Hi, We need to change where the primary logo links to (which is different than what’s listed under “WordPress Address (URL)” and “Site Address (URL)” under Settings > General). What’s the best way to do this? Thank you! March 24, 2017 at 5:29 am #765873Hey franktw, Try adding this code at the bottom of functions.php: function change_logo_link(){ ?> <script type="text/javascript"> (function($){ function change_logo_link() { jQuery("#header_main").find(".logo a").attr("href", "http://www.google.com/"); } change_logo_link(); })(jQuery); </script> <?php } add_action('wp_footer', 'change_logo_link');Hope this helps :) Best regards, 
 NikkoMarch 24, 2017 at 7:00 pm #766346Thanks. I think I know the answer, but is there any way to do this without modifying code? March 25, 2017 at 4:02 am #766443Hi, No, I think this is the easiest way to do it. The other way would be using a child theme, copy and paste header.php and tweak it :) Best regards, 
 NikkoMarch 25, 2017 at 3:31 pm #766626We really don’t like modifying core code or functions.php but are happy to inject code using a plugin framework (i.e. simply adding functions/code to a simple plugin and installing that plugin). Can you (or anyone else) think of a way to change the logo link destination via PHP code / function that can be installed via the plugin framework (so we can keep the code separate)? Thanks! March 26, 2017 at 4:38 am #766807March 26, 2017 at 9:22 pm #767062Yes, I know that’s possible but we were hoping to use an external function in a Plug-In rather than having to deal with a Child Theme and the management thereof. If there’s a way to use a self-contained function we can add to a plug-in, that would be ideal. March 26, 2017 at 10:20 pm #767077Hey! You can create a plugin 
 https://codex.wordpress.org/Writing_a_Pluginand add the code there, if that works out for you Regards, 
 BasilisMarch 26, 2017 at 11:30 pm #767094Thanks. Could you provide a variant of the function (listed above) that can be put in that plugin? Thanks again! March 27, 2017 at 4:09 am #767154Hi, You might want to check this post: https://www.doitwithwp.com/create-functions-plugin/ Best regards, 
 NikkoMarch 27, 2017 at 3:53 pm #767513Thanks. I understand how to create the plugin, just need a modification of the code you posted above so it can work standalone in the plugin. Thanks again! March 28, 2017 at 3:01 pm #768177Hi, Please add following code to Functions.php file in Appearance > Editor to change logo link as needed add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link) { $link = "http://kriesi.at"; return $link; }Best regards, 
 YigitNovember 24, 2018 at 11:16 pm #1037305Is it possible to open my custom logo-link in a new tab? Best regards November 26, 2018 at 11:04 pm #1037827Hi Bewohnerfrei, Could you please give us a link to your website, we need more context to be able to help you. Best regards, 
 VictoriaMarch 15, 2019 at 10:55 pm #1079288in this case i would not take the elegant way over the filter but combine all attributes in one rule: 
 ( You see how it works? – every new attribute is comma separated (except the last one) )function custom_logo_attriubtes(){ ?> <script> (function($){ $('.logo a').attr({ "href": "https://your-domain", "target": "_blank", "title": "custom_title", "alt": "custom_alt" }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_logo_attriubtes');
 PS on those attributes you do not need to have arround href or targe the double quotes. But on others ( f.e. data-attributes ) you do – so if you don’t like to rembember where to use and where not – use them allwaysMarch 17, 2019 at 7:45 am #1079554March 22, 2021 at 11:21 pm #1289730This reply has been marked as private.March 23, 2021 at 12:29 pm #1289847Hi, 
 @alfonsosdc glad you figured it out! Let us know if you have any other questions or issues and enjoy the rest of your day :)Best regards, 
 Yigit
- 
		AuthorPosts
- You must be logged in to reply to this topic.
