Home Forums WoodMart support forum How can I add my custom meta tag?

How can I add my custom meta tag?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #130091

    SmartInk
    Participant

    Hello, I have 4 versions of my store for a few regions and I have a need to add hreflang. But I don’t understand how can I edit head of the site. Can you help me or give some advice?

    #130115

    Hello,

    We recommend finding a plugin as the default Woocommerce does not provide the options.

    If you want to add code to the Header, you would better use this plugin https://wordpress.org/plugins/insert-headers-and-footers/

    Best Regards

    #130241

    SmartInk
    Participant

    Thank you for your advice! It’s a perfect solution for static code, but I need to get my current URL. Like: <link rel=”alternate” hreflang=”en-ca” href=”<– Current URL here –>” />

    Maybe you can give an advice for this situation? Thank you very much!

    #130286

    Hello,

    You need to add the code to the functions.php of the child theme

    function woodmart_add_link_to_head(){
    	global $wp;
    
    	?>
    		<link rel="alternate" hreflang="en-ca" href="<?php echo home_url( $wp->request ); ?>" />
    	<?php
    }
    add_action( 'wp_head', 'woodmart_add_link_to_head'); 

    Best Regards

Viewing 4 posts - 1 through 4 (of 4 total)