HTML

ソースコードをHTML5化

'18.12.08

functions.phpに下記を追記

// コンテンツ
add_filter( 'the_content', 'imgHTML5' );
function imgHTML5( $content ) {
$content = str_replace('" />', '">', $content);
$content = str_replace('<br />', '<br>', $content);
$content = str_replace('<p>&nbsp;</p>', '<br>', $content);
return $content;
}
//ヘッダーソース
add_action( 'template_redirect', 'get_header_thk', 99 );
function get_header_thk() {
if( is_feed() ) { return; }
ob_start();
get_header();
$head = ob_get_contents();
ob_end_clean();
$head = str_replace( "'", '"', $head );
$head = str_replace( array("\r\n","\r"), "\n", $head );
$head = str_replace('" />', '">', $head);
echo $head;
}

 

(View765)