i change the article title display mode,Encounter problems

hi engneer~

ichange the article title display mode

form


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

Revised to

<title><?php if ( is_single() ) { ?><?php wp_title(''); ?>_<?php foreach((get_the_category()) as $category) { echo $category->cat_name; } ?> <?php } ?></title>

The purpose is to make the article appear as:

<title>Article name_Directory name_Blog name</title> (Maybe my above code sequence error)

Encounter two problems:

1.when i change /inc/extras.php ,in child theme is Invalid?

2.when i change /inc/extras.php, in father theme is Effective,but No specific change.(title is <title>article name|blog name<title>,but my new code add to header.php is ok)

so, i Want to solve, look forward to your help, to pay tribute!

Hi @ibolee,

I hope you are well today and thank you for your questions.

1.when i change /inc/extras.php ,in child theme is Invalid?

If you make changes in the theme file then you have to make these changes again after theme updation as changes made in the theme files get lost on theme updation.

2.when i change /inc/extras.php, in father theme is Effective,but No specific change.(title is <title>article name|blog name<title>,but my new code add to header.php is ok)

In the Dazzling theme we have displayed the page title using latest ‘title-tag’ feature added in the WordPress Version 4.1 so to change the title you have to use the filter wp_title as displayed in the following sample code.

function filter_function_name( $text ){	
	return $text;
}
add_filter( 'wp_title', 'filter_function_name', 10, 2 );

Best Regards,
Movin