Home > concrete5 for developers > For concrete5 theme developers: body background workaround

For concrete5 theme developers: body background workaround

September 15th, 2009 Leave a comment Go to comments

Anyone who regularly works with concrete5 themes could face with the following issue:

If you sign in as admin, the concrete5 editing toolbar appears at the top of all pages. This sometimes can cause a problem making body background not align properly with some other images on the page if it was designed as a single picture. There is a workaround I’m going to tell you about.

Use this condition in concrete5 theme php files:

<?php
global $cp;
if (is_object($cp) && ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage())) {
	echo ' style="background-position: 0 50px;"';
}
?>

The above example shows how you can add ‘ style="background-position: 0 50px;"’ when the editing toolbar is being displayed. You can use it to add style to body. ‘background-position: 0 50px’ will make the background shift 50 pixels lower from the top of the window. You can use this to append some extra class or style attribute to any element that gets corrupt when admin is signed in.

If you have any difficulties doing concrete5 theme, you can request free quote on our concrete5 theme integration service.

Categories: concrete5 for developers Tags:
  1. April 19th, 2010 at 05:13 | #1

    Just tried this on my site and couldn’t get it to work; however, I found this similar solution which did work:

    http://www.concrete5.org/community/forums/customizing_c5/edit-bar-is-hiding-the-top-section-of-my-site/

    Thoughts? Cheers and thanks for the tips.

  1. No trackbacks yet.