문제

I'm currently designing a theme using Underscores and I want to do something like this with the site's title:

Thisisthetitle

So the title is all one word and the last five characters are different to the rest. I am currently using the bloginfo function to display the title and I can't figure out a way to split it so I can style each section of the title differently.

I have tried creating a function to splice it, but to no avail.

도움이 되었습니까?

해결책

Figured it out!

function split_title($title) {
$title = get_bloginfo('name');
$word = substr($title, 0 , 5);
$press = substr($title, 5);

$html = "{$word}<span class='bold'>{$press}</span>";

return $html;
}

And then <?php echo split_title($title); ?>

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top