Last active
January 2, 2017 10:56
-
-
Save ibrahimkholil/2cf68ae5fea226cd991b7f7906ea7f95 to your computer and use it in GitHub Desktop.
Title tag wordpress dynamically for theme forest supported
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<title><?php | |
/* | |
* Print the <title> tag based on what is being viewed. | |
*/ | |
global $page, $paged; | |
wp_title( '|', true, 'right' ); | |
// Add the blog name. | |
bloginfo( 'name' ); | |
// Add the blog description for the home/front page. | |
$site_description = get_bloginfo( 'description', 'display' ); | |
if ( $site_description && ( is_home() || is_front_page() ) ) | |
echo " | $site_description"; | |
// Add a page number if necessary: | |
if ( $paged >= 2 || $page >= 2 ) | |
echo ' | ' . sprintf( __( 'Page %s', 'bloger' ), max( $paged, $page ) ); | |
?></title> | |
if above code note support in themeforest use below code: | |
====== function.php:=============== | |
function bloger_wp_title($title, $sep){ | |
global $paged, $page; | |
if ( is_feed() ) | |
return $title; | |
$title .= get_bloginfo( 'name' ); | |
$site_description = get_bloginfo( 'description', 'display' ); | |
if ( $site_description && ( is_home() || is_front_page() ) ) | |
$title = "$title $sep $site_description"; | |
if ( $paged >= 2 || $page >= 2 ) | |
$title = "$title $sep " . sprintf( __( 'Page %s', 'orangeidea' ), max( $paged, $page ) ); | |
return $title; | |
}add_filter( 'wp_title', 'bloger_wp_title', 10, 2 ); | |
======================header.php=============== | |
wp_title( '|', true, 'right' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment