What is the correct way to output a title like “Nice post or page title | Website name”?

Question

I’m developing a theme for Themeforest and one of their requirements is about the tag. Themeforest states their requirement as follows:

The theme must let WordPress add and manage the title. This is done by adding add_theme_support( 'title-tag' ); to functions.php instead of using wp_title() in the document head.

I currently have the following code in my header.php file:

<title><?php wp_title('|','true','right'); ?><?php bloginfo('name'); ?></title>

As an example, the title would be generated like Nice post or page title | Website name.

I added the theme-support to the functions.php, but now I don’t know how to change the code for the title tag in such a way that the output will be the same as I currently have.

How do I change my code for the so that I keep the current form but also comply with Envato?

Many thanks in advance!

0
, , , ralphsmit 3 years 2020-07-06T07:11:00-05:00 0 Answers 74 views 0

Leave an answer

Browse
Browse