wp_title

Posted in: Newspaper
Post count: 12

Can you explain more Easily, how do I use this code, I found this code from https://developer.wordpress.org/reference/functions/wp_title/#

Covering Homepage
If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title. Here goes a neat hack to add the description/tagline at the wp_title place on homepage:

<title><?php wp_title(”); ?></title>
Then in your functions.php file in your theme:

add_filter( ‘wp_title’, ‘wpdocs_hack_wp_title_for_home’ );

/**
* Customize the title for the home page, if one is not set.
*
* @param string $title The original title.
* @return string The title to use.
*/
function wpdocs_hack_wp_title_for_home( $title )
{
if ( empty( $title ) && ( is_home() || is_front_page() ) ) {
$title = __( ‘Home’, ‘textdomain’ ) . ‘ | ‘ . get_bloginfo( ‘description’ );
}
return $title;
}

Post count: 22421

Hi,
This represents customization and it’s not covered by the theme support unfortunately. We try to help where we can but custom code related questions are not covered. It is not as simple as copy pasting a specific code and that’s that. Our theme already uses wo_title like so: http://screencast.com/t/iWKRGsVHjhttp://screencast.com/t/G9KxkqJWp
If you want to alter this function, we recommend hiring a freelancer to help out from sites like studio.envato.com
Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.