Working on a theme and I'd like the copyright and title texts on the footer to be automated. It works but the tittle switches to the current page instead of the website's main title when you switch pages. How do I get it to stick to the website's main title or home page title.

My line of code is as shown below.

 &copy;<?php echo date("Y"); ?> <?php the_title(); ?>

the_title is always the title of the current post. What you probably want is something like wp_title or get_bloginfo and bloginfo('name');. Take a look at your headers code to see exactly what your theme uses

|improve this answer|||||
  • 1
    I think you can just use get_bloginfo(); to return the a site title by default. – Wyck Apr 21 '14 at 18:29
  • Use get_bloginfo('name') to return blogname – Pieter Goosen Apr 21 '14 at 18:37

Just for info, here is another function you can use to display copyright info

function wpse_copyright_in_footer() {
         $all_posts = get_posts('post_status=publish&order=ASC');
        $first_post = $all_posts[0];
        $first_date = $first_post->post_date_gmt;

        _e('Copyright &copy; ');
        if ( substr($first_date,0,4) == date('Y') ) {
          echo date('Y');
        } else {
          echo substr($first_date,0,4) . "-" . date('Y');
        echo ' <strong>' . get_bloginfo('name') . '</strong> ';


You can then just simply call it like this in your footer.php

<?php echo wpse_copyright_in_footer(); ?>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.