Clinton Green
Clinton Green

Reputation: 9977

Wordpress add html to Site Title

I want to bold one of the words in the site title of a wordpress blog. I read that this is not possible so I went the jquery route to replace the text but it is not working either.

I have tried placing the code below in the header.php and footer.php but I can't get it to run .

<!-- Change site title -->
<script type="text/javascript">
    $(document).ready(function() {
        $("h1#site-title a").text("name<b>surname</b>");
    });
</script>

Upvotes: 0

Views: 1274

Answers (1)

Ohgodwhy
Ohgodwhy

Reputation: 50777

If you're going to try to directly insert that into the header.php file instead of using the proper wp_enqueue_script() method, then three things need to take place.

1) - You need to make sure this is called after wp_head()

2) - If you're trying to insert html into the document, then you need to use .html()

3) - There may be some conflict, so you should use the no conflict ready handler

jQuery(function($){
    $("h1#site-title a").html("name<b>surname</b>");
});

Upvotes: 1

Related Questions