Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ibrahimkholil/2cf68ae5fea226cd991b7f7906ea7f95 to your computer and use it in GitHub Desktop.
Save ibrahimkholil/2cf68ae5fea226cd991b7f7906ea7f95 to your computer and use it in GitHub Desktop.
Title tag wordpress dynamically for theme forest supported
<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