Skip to content

Instantly share code, notes, and snippets.

@kprimdal-dk
Last active December 14, 2015 01:09
Show Gist options
  • Save kprimdal-dk/5003892 to your computer and use it in GitHub Desktop.
Save kprimdal-dk/5003892 to your computer and use it in GitHub Desktop.
Href Lang i Header på bestemt side
<?php
function mux_header_lang() {
global $post;
if ( is_page() ) {
$hreflang = get_post_meta( $post->ID, 'hreflang', true );
if ( $hreflang ) {
$ref = get_post_meta( $post->ID, 'ref', true );
?>
<link rel="alternate" hreflang="<?php echo $hreflang ?>" href="<?php echo $ref ?>" />
<?php
}
}
}
add_action( 'wp_head', 'mux_header_lang' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment