Forum Replies Created
-
AuthorPosts
-
DragNfLyMember
Nope,
If you do not have the starter pack installed, the Attributes section is not available.
DragNfLyMemberYes, the 'add_action' calls this to 'head' of the page.
My scenario is a workaround as I am targeting 2 different languages for the same region. LOL > South Africa has 11 official languages. #hreflangnightmare
I would imaging there would be a different method for multi-region.
DragNfLyMemberHi @samw
Yes, i did it the long way round, which is probably exactly what you require.
Code below in functions.php:
// MY REL ALTERNATE add_action( 'wp_head', 'rel_alternate' ); function rel_alternate() { // Insert Rel=Alternate if post is if ( is_single( '820') ) { echo '<link rel="alternate" hreflang="af" href="#" />'.PHP_EOL; } elseif ( is_single( '9150') ) { printf( '<link rel="alternate" hreflang="af" href="#" />').PHP_EOL; } }
I then add the Canonical URL to the Page settings 'Custom Canonical URL'
...and also exclude the 'hreflang page' from my Sitemap
I use the XML Sitemap & Google News feeds plugin which adds a 'Exclude from XML Sitemap' field to each post in the righ-hand sidebar.I am not sure if this is the correct way of doing this.
Good luck
🙂DragNfLyMemberThanks for your reply.
The Advanced Custom Post Type Repeater Addon is $25.00 AUD. So I'd rather follow my example above even though there are several pages; 30+ that will require hreflang tags.
I am however trying to get my head around the repeater fields. How would these hook into
wp_head
.This feature would be great addition to the 'Theme SEO settings tab' in Genesis the same way they offer to do 'Canonical'.... an afterthought for your plugin idea.
Thanks again
DragNfLyMemberHi Susan / Forum
I have been battling with this and have created a custom function to hook into wp_head.
Can anyone please let me know if this is the correct way to do this.
// Rel Alt Function add_action( 'wp_head', 'rel_alternate' ); function rel_alternate() { // Insert Rel=Alternate if post is if ( is_single( '150') ) { echo '<link rel="alternate" hreflang="af" href="#">'; } elseif ( is_single( '152') ) { echo '<link rel="alternate" hreflang="af" href="#">'; } }
Any comments welcome
DragNfLyMemberHi Forum
I would appreciate some assistance re. the above issue. Any ideas?
Many Thanks
DragNfLyMemberHi Susan
I would appreciate some assistance re. the above issue.
Many Thanks
DragNfLyMemberHi SoZo
Body class was the give-away there. FireBug revealed it as postid-6450 and not post-id-6450.
Thanks a mill.
-
AuthorPosts