Would you happen to know how one could go about scooting the site name up a little bit, placing the site slogan below it, and making the site slogan smaller in Garland?

What I can find is this:

// Prepare header
$site_fields = array();
if ($site_name) {
$site_fields[] = check_plain($site_name);
}
if ($site_slogan) {
$site_fields[] = check_plain($site_slogan);
}

in page.tpl.php, but I wouldn't have any idea how to attach CSS classes to something like that (I do not know php at all).

Much appreciated!

Comments

mcjim’s picture

Have a look at the page source in your browser, then you'll know what classes/ids are already there for you.

coltrane’s picture

The name and slogan are contained in structures you can target with css to style how you'd like. Use Firebug (if you're browsing with Firefox) to easily see the HTML structure around those items, then edit the css for Garland to style them how you'd like. Note, since Garland is a core theme any edits you do will be erased on an upgrade - you could make a copy of the theme and give it a different name, then house it under sites/all/themes.

iandickson’s picture

Is often useful for organizing placement issues, esp if, like me, you don't do enough CSS to solve it that way.

Ian Dickson

Likal.com

darumaki’s picture

My challenge with this is the slogan is wrapped inside the header h1 a:link with the logo and i only want to style the slogan, actually i want to relocate it but since its part of the logo can't do one with out the other. Would be nice if there were a way to separate them

portfola’s picture

I also want to add a break between the site name and slogan, and make the slogan smaller font. But can't figure out how they have combined the two. Any help here?

droshani’s picture

I have the same problem. I think the Slogan is taking too much space and it should be beneath the Site name much smaller font/Italic. May be if we put this forward as a new feature so the developer would consider this customization for next update. It is not worth it play around with Theme and then loose all work with next update. Even if you give it another name and use it separately you may loose the chance for new features which come in future updates.

I have added this please consider to support it
http://drupal.org/node/226943

Thanks

iandickson’s picture

The thing about themes is that once you have tweaked it via tpl and css files you should save under a new name, then add the New theme to the site.

That way subsequent updates etc won't undo your work.

Ian Dickson

Likal.com

droshani’s picture

So If I can not use the future updates that means I just enjoy an old Theme which shows the Slogan nice. I think we should ask developer to consider the change so it wont effect the future updates.

dwrunyon’s picture

I am still very much interested in this "issue". I have discovered that one can change the sizes of the site title / slogan either by adding custom styles into the style.css for:

#header h1
#header h1 span

and using the !important command to force the changes. The #header h1 styles both to the size that you want the slogan to be, and then the #header h1 span re-enlarges the site title proportionally,

OR by adding a little bit of code to line 35 of page.tpl.php thusly:

Change $site_html = implode(' ', $site_fields);

to

$site_html = implode(' ', $site_fields) .'';

Now I wish to set a break between them so that the slogan will be under the title.

dwrunyon’s picture

Found another way to do it that I like much better... changed:

$site_fields[0] = '<span>'. $site_fields[0] .'</span>';
$site_html = implode(' ', $site_fields);

to:

$site_fields[0] = '<span class="sitename">'. $site_fields[0] .'</span>';
$site_html = implode('<span class="slogan">', $site_fields) .'</span>';

and then added custom CSS to the bottom of style.css (for ease of updating with upgrades... adjust to your taste):

.sitename {
font-size: .82em;
}
.slogan {
font-size: .46em;
margin-left: 4px;
color: #CCCCCC;
}

This made my site title a little smaller (which I wanted), made the slogan even smaller... scooted the slogan out to the right just a bit, and gave it a contrasting color.

I would still very much prefer it to be UNDER the sitename though. I made it work with relative positioning (scooted the site name up, then scooted the slogan over to the left up under it), but it didn't position properly in IE6 (worked identically in Firefox and IE7, but in IE6 the slogan was a little too far right). I am sure there is some form of "IE hack" that can be done in CSS, but I do not know enough to either Google it (found TONS of random IE hacks), much less implement it, and any time I place a break in there it scoots WAY down into the menu below!

Anyway, as it stands this is the most satisfying method for me personally.

BlueRaja’s picture

There are obviously many ways to do it, but here was my solution:
First, remember to copy the garland theme to sites/all/themes/myThemeName, and change the name of the theme in garland.info. This isn't necessary, but as someone pointed out, this prevents your changes from being overwritten when the theme updates.

Second, in page.tpl.php, change this:

$site_fields = array();
if ($site_name) {
  $site_fields[] = check_plain($site_name);
}
if ($site_slogan) {
  $site_fields[] = check_plain($site_slogan);
}
$site_title = implode(' ', $site_fields);
if ($site_fields) {
  $site_fields[0] = '<span>'. $site_fields[0] .'</span>';
}
$site_html = implode(' ', $site_fields);

to this*:

$site_fields = array();
$site_title = '';
if ($site_name) {
  $site_title = check_plain($site_name);
  $site_fields[] = '<div id="sitename">'.$site_title.'</div>';
}
if ($site_slogan) {
  $site_fields[] = '<div id="slogan">'.check_plain($site_slogan).'</div>';
}
$site_html = implode(' ', $site_fields);

*This also changes the title of the link (ie. what you see when you hover the mouse over the link) from "sitename slogan" to just "sitename."

Then in style.css, change this:

#wrapper #container #header h1, #wrapper #container #header h1 a:link, #wrapper #container #header h1 a:visited {
  line-height: 120px;
  position: relative;
  z-index: 2;
  white-space: nowrap;
}

#wrapper #container #header h1 span {
  font-weight: bold;
}

#wrapper #container #header h1 img {
  padding-top: 16px;
  padding-right: 20px; /* LTR */
  float: left; /* LTR */
}

to this:

#wrapper #container #header h1, #wrapper #container #header h1 a:link, #wrapper #container #header h1 a:visited {
  top: 13px;
  line-height: 22px;
  position: relative;
  z-index: 2;
  white-space: nowrap;
}

#wrapper #container #header #sitename {
  font-weight: bold;
}

#wrapper #container #header #slogan {
  /*Put whatever CSS you want for the slogan here*/
}

#wrapper #container #header h1 img {
  padding-top: 3px;
  padding-right: 20px; /* LTR */
  float: left; /* LTR */
}

You may need to adjust the line-height/top properties to your liking.

Now edit CSS for the slogan however you want. For instance, mine looks like this:

#wrapper #container #header #slogan {
  font-style: italic;
  font-size: 0.6em;
}

And finally, of course, make sure to apply the new theme (you need to do this even if you didn't create a new directory, in order to refresh the css file).

Hope that helps!

droshani’s picture

It is working perfect. Thank you for the hard work.
Please see here
http://98.131.16.97/

droshani’s picture

I released that it will push the logo of the site down a bit in IE7. It will work perfect in FireFox 2.x and Safari but the master of "killing freedom on Internet" the IE7x does not work. Please have a look at my site in IE7.x http://98.131.16.97/

droshani’s picture

I tried this one in new release of Drupal 6.2 and it did not work. Do you have any suggestion, please?

Wolfflow’s picture

Great solution. It works in Drupal 6.2
Thanks a lot BlueRaja ;-)

Share your experience with the Open Source Community
it's not only a choice but a Life Philosophy !!!
http://www.adaccs.at : A Drupal advanced CSS Content System - Community Project

Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.

JoshOrndorff’s picture

I can't tell you how relieved I was to find out that others were frustrated with the way the slogan is handled in garland. I'm also a little disappointed to see that it's been a few years since this post was created and it isn't changed.

In any case, the fix here is exactly what I wanted so thanks a lot!

Rather than copying the whole garland folder and changing the code, it is probably better to make a sub-theme of garland so that when other aspects of garland are updated, you can reap the benefits but still not lose your personal customizations. Here is what I did:

Because minnelli is already a subtheme of garland, you can start there.
1. Copy the directory from /themes/garland/minnelli to /sites/all/themes/mytheme
2. Rename minnelli.css to mytheme.css
3. Rename minnelli.info to mytheme.info
4. Open mytheme.info and change all the instances of "minnelli" to "mytheme" (there are only like 2 or 3 occurrences, so not a big deal)
5. Copy garland's page.tpl.php from /themes/garland/page.tpl.php to /sites/all/themes/mytheme/page.tpl.php
6. Open your new copy of page.tpl.php and make the changes that Blue Raja describes above.
7. Open your mytheme.css file. The code that is in there is what makes minnelli a fixed-width theme, so if you want fluid width like garland, then remove the code, or if you want fixed width leave it in. At the bottom of the file, add the css that BlueRaja describes above and modify it to your liking.
8. Many parts of a theme including page.tpl.php are cached in drupal so go to Administer > Performance, scroll to the bottom, and click the clear cache button. It is always a good idea to clear your theme cache when you are modifying a theme lest you get frustrated that your changes aren't working

I realize that this is a few extra steps, and may take a little longer, but making the subtheme will give you the benefit of not losing your changes when garland is updated, AND will also not prevent you from getting any other improvements that are made when garland is updated. And as a little extra bonus, this fits better with the drupal quality standards.

Thanks a lot for the code BlueRaja, I had been working on something (much more complicated and not as nice) for a few hours before I found your post!

Best Wishes,
-Josh

aerel’s picture

I can't get it to work either. The slogan doesn't show up at all.