1

In the four themes I tried before choosing the one I have now, the name of my website was always featured with the copyright in the footer of my webpages, but now all it says is "Copyright © 2013, ."

Is there an easy way for me to adjust the code so it does credit the site after that comma and before the period? I'm not very familiar with code so I'd be ever so grateful for an easy way. I tried searching for the copyright sign and the year in a few pages but they didn't show up so I suspect there are other ways to describe those in code, right? :)

2

First, make sure your site name is stil configured correctly. You can do this by going to yoursite.com/admin/config/system/site-information.

If the site name is there and still does not show up, then the theme you've selected is likely not working correctly. Head over to yoursite.com/admin/appearance and click on 'Settings' next to the theme you're using. Browse around and see whether there are any options to set the copyright message.

Failing that, modify the message directly in the template files. You will have likely installed your theme to /sites/all/themes/theme_name or /sites/default/themes/theme_name. Browse to this folder and look for a file called page.tpl.php (it may be in a subdirectory). This file will likely contain the copyright message which you can change right then and there. Alternatively, the copyright message maybe in the html.tpl.php file, which should be in the same location as page.tpl.php.

  • I'm looking at the page.tpl.php (because all other options were indeed configured correctly) and it seems to have a correct code: <div id="copyright"> <?php if (theme_get_setting('footer_copyright')): ?> <?php print t('Copyright'); ?> &copy; <?php echo date("Y"); ?>, <?php print $site_name; ?>. <?php endif; ?> I tried removing some of the code and adding the site name (I know, silly), but it still shows up without the name. – Claudi Mar 1 '13 at 9:17
  • From the code above, the site name should be printing out from the $site_name; variable, but it looks like it must be empty. Try replacing <?php print $site_name; ?> with your site name (ex. Claudi's Blog) and see what happens. And of course, double check that the page.tpl.php you're editing is in the theme folder for the theme that's currently active. – Yuriy Babenko Mar 1 '13 at 17:50
1

A simple solution which might work for you and doesn't require codework: In the admin menu, select "Structure > Blocks", then add a new block and in the Block body type in the footer text you want, and save. Then in the main Blocks page assign your new block to the "Footer" region. Only downside to this you'll have to update the copyright date once a year :)

  • Thanks! I'm going to use that tip for now until I'll be able to change any code haha! :D – Claudi Mar 1 '13 at 9:20
  • When you're ready to venture into coding, create a module and in it create your footer programmatically for example: function my_module_block_info() { $blocks['my_footer'] = array( 'info' => t('My Footer'), 'cache' => DRUPAL_NO_CACHE, 'region' => 'Footer', 'status' => 1, ); return $blocks; } function my_module_block_view($delta = '') { switch ($delta) { case 'my_footer': $markup = 'Copyright &copy; ' . strftime ("%Y") .' MY NAME</span>'; $block['content'] = $markup; break; } return $block; } Then assign "My Footer" block to the Footer region in Blocks menu. – longboardnode Mar 1 '13 at 9:37
0

With Drupal 7 you can save the Text Format of the block as PHP code, so you can add the <?php echo date("Y"); ?> and it will display the year.

  • No, never inject PHP code into the database. This example is pretty safe but to do it you need to turn the PHP filter on, and that opens a door into building a fragile and insecure site with all sorts of interesting failure possibilities. drupal.stackexchange.com/questions/2509/… – Alfred Armstrong Feb 22 '18 at 10:00

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.