外掛說明
Hamzaban is a plugin that helps you add and manage hreflang tags for your WordPress site. Hreflang tags are essential for SEO, especially for multilingual sites, as they tell search engines which language and regional URLs to serve to users based on their location and language preferences.
Features
- Add hreflang tags to posts, pages, and custom post types.
- Manage hreflang tags through a simple meta box in the post editor.
- Display hreflang links in your theme’s navigation menu.
- Option to enable or disable the display of hreflang links in the navigation menu through the plugin settings.
Usage
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Go to the post or page editor, and you will see a meta box to add hreflang URLs and languages.
- Done! hreflang metatag will be added to your website pages head.
- You can use the provided function or template tag to display the hreflang links in your theme.
Display Hreflang Links in Theme
To display the en
language URL in your theme, use the following code:
`php
<?php
if ($hreflang = array_filter(get_post_meta(get_the_ID(), '_hamzaban_post_langs', true), function($lang) { return $lang['lang'] === 'en'; })) {
$hreflang = reset($hreflang); // Get the first match
echo '‘ . __(‘English Version’, ‘hamzaban’) . ‘‘;
}
?>
使用者評論
這個外掛目前沒有任何使用者評論。