Modularity Lite returns with version 1.3, this time boasting WordPress Menus and a dynamic slideshow option to keep us excited. You can even change colours and your background image. Making it your own was never easier. Here are my notes from when I created minor amendmends for Simon’s website SoundCredit.tv.
My original article on how to style this puppy goes back to version 1.1. With each update, the code has dramatically changed and therefore needs different tweaks. If you’re running an older version of Modularity Lite, check out my instructions for Version 1.2.
Instructions Included
Your first port of call when tweaking this theme is to check out the included instructions. They can be found as handy HTML file in /wp-content/themes/modularity-lite/instructions.html. So if your website is www.yoursite.com, and WordPress is installed in your root directory, you can read them browsing http://www.yoursite.com/wp-content/themes/modularity-lite/instructions.html
It’s essential reading. Tells you a lot – but not everything
Dynamic Slideshow
The new dynamic slideshow pulls in images from your last 5 posts and displayes them. For this to work, you’ll first have to enable the slideshow by ticking the box in Appearance – Theme Options.
I had some trouble getting images to show up, so here’s what I’ve learnt:
- Images need to be associated with posts. If you add them to a page, or if you upload them via the media uploader without associating them to a post, those images will not show up in the slideshow.
- Your slideshow is 950×425 pixels by default. If you upload images that are smaller than this, they will not show up.
To reiterate: Slideshow images MUST BE exactly 950×425 pixels or larger. Smaller images WILL NOT show up. Don’t ask me why – I’m just the messenger
Slowing Down the Slideshow
Again this has slightly changed from previous versions. Those transition effects are done with something called Jquery Cycle Plugin. For our purposes, we need to have a look at the functions.php file and find this bit of code at the bottom of the file:
jQuery("#slideshow").cycle({
speed: '2500',
timeout: '500',
pause: 1
The “timeout” value is the one we want to change. Change it to 5000 and your slides will show for 5 seconds, 10000 will show them for 10 seconds, etc.
The “speed” value is responsible for the transition duration. The default looks good to me, but try 5000 for sloooower transitions, or even 1 for cuts between pictures.
Static Slideshow
I wanted to build a brochure site with static pages and didn’t need the CMS or “posts” part of the website. By default however, the slideshow only displays when you show “your latest posts” on your homepage. It disappears when you show “a static page” (you can select this under Settings – Reading).
My first idea was to only show one post on the front page and be done with it – however this will only display the image from the post shown. Images from Posts that are not shown are not incorporated into the dynamic slideshow. Bugger!
This leaves us no option but to re-write the code that used to work so well in Version 1.2. Let’s do that. First, let’s create a folder for our images:
- in the theme folder (/modularity-lite/) find the /images/ folder and create a new one called /slideshow/ – just like in the old version you’ll end up with /modularity-lite/images/slideshow
- find 5 suitable images you’d like to use for the slideshow (950 x 425px or larger)
- name them “image1.jpg”, “image2.jpg” and so forth amd upload them into the slideshow folder
Next, edit the page.php file and find where the get_header() statement is executed. Right underneath it we’ll call the slideshow images by adding this bit of code:
<!-- Begin slideshow -->
<div id="slideshow">
<div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/slideshow/image1.jpg" alt="<?php bloginfo('name'); ?>" /></div>
<div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/slideshow/image2.jpg" alt="<?php bloginfo('name'); ?>" /></div>
<div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/slideshow/image3.jpg" alt="<?php bloginfo('name'); ?>" /></div>
<div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/slideshow/image4.jpg" alt="<?php bloginfo('name'); ?>" /></div>
<div><img src="<?php bloginfo('stylesheet_directory'); ?>/images/slideshow/image5.jpg" alt="<?php bloginfo('name'); ?>" /></div>
</div>
This will rotate our new images on each and every page – no questions asked.
If you would like to use the static slideshow on your “blog” page instead, then insert the above code in the index.php file (again underneath the get_header() statement).
Conditional Slideshow – only show it on certain Pages
Making the above principle of the Static Slideshow conditional is a tad more tricky because it requires more coding; say you have 5 static pages and you only want the slideshow to show up on one of them, that sort of thing. Here’s what you need to do:
- take the above slideshow code and put it in an empty text file
- call it “slideshow.php”
- upload it into the theme’s directory (in our case the full path is wp-content/themes/modularity-lite)
- find out which page ID you’d like the slideshow to appear on – I’ll explain how this works in a minute
Next, open your page.php file and add the following conditional statement underneath the get_header() statement. For this example, we’ll assume your page ID is 11:
<?php
if ($page_id == 11)
include ('slideshow.php')
?>
This snippet will check if we’re on the right page, and if that is the case it loads the code from above via the file you’ve uploaded. If we’re on any other page it simply ignores the file and no slideshow is displayed.
To find out your page ID, go to Pages and hover your mouse over the page titles. Keep an eye on your browser status bar at the bottom – you’ll see the value change where it says “…?post=11″ – that number is your page ID.
Changing the Slideshow Height
Would you like to adjust the height of the slideshow? That’ll turn it into animated headers – very swish indeed! All you need to do is take a look at the style.css file and find the following snippet (it’s towards the end):
/* Slideshow */
#slideshow {
padding: 0;
list-style: none;
margin: 0 0 3em 0;
overflow: hidden;
min-height: 425px
}
Adjust the min-hight parameter to something like 200px and your slideshow loses some height. Regardless of how tall your pictures are they will be cropped automatically (and free of charge… nice!)
Pages: 1 2





{ 219 comments… read them below or add one }
← Previous Comments
Next Comments →
Hello, do you know were and how to rename the .mo language file ?
Hi Emmanuel,
I’ve just had a look but I don’t think this theme is ready for translation as far as I can see – there’s no .mo file for this theme. Many standard messages will be translated via Wordpress I believe. You can define your locale in wp-config.php.
In fact the theme is ready for translation. I’ve create a new po file with PoEdit and it scan all theme’s files. Then I translate it.
Next step is to add this in function.php :
load_theme_textdomain(‘modularity’);
Last step consist to put the mo file in the template directory, and the name must be fr_FR.mo for exemple.
Whoa, that’s amazing! Well done
Make sure you spread the good news at Graphpaperpress.com – I’m sure they’ll include it in the official repository
All the best from London–
thank you soooooooooooooooooo much for the info on getting photos to display in the slideshow. i almost gave up and switched themes…my last ditch effort came from this post, changing the photos to be exactly 950px width had them appear in the slideshow!!!!
the height didn’t have to be exactly 425px – good thing, because I didn’t want to crop my photos that much
Hi Stephanie,
glad it worked for you – your site looks great! And well done for making the move to Panama – very inspiring. We’re about to do the same and will move from London to Miami Beach.
All the best–
JAY
Hi Jay,
I have 3 questions for ya, since you’ve been so helpful!
1. My client’s website is http://www.61northband.com. How do I add a static image above the blog on the homepage? I would like this image to be top-aligned with the sidebar. It would shift the blog down on the page a bit, but the sidebar would stay where it is.
2. How do I change the width of the sidebar, so that the sidebar takes up less horizontal space? I am looking to give more room to my client’s blog and also more room to the main content on static pages.
3. How do I remove the thin black vertical line that is stuck to the left edge of the sidebar? (The line that divides sidebar from the blog or main page content.)
Sincerely,
Alicia
Hi Alicia,
very sorry about the delay in my reply, life’s caught up with me. Looks like you’ve got the header problem sorted already – well done
Just to let you know, I seem to be getting a Malware Warning when I browse your site. Have a look what’s going on there. Something about bid.openx.net.
The thin black line by the sidebar is defined by this code in style.css:
.colborder {
border-right: 1px solid #000
}
Easiest way to get rid of it would be to set it to 0px.
I’ve been fiddling with the width of the sidebar but without much success I must admit: it’s generated dynamically from the container size and the container inner, what’s left is the space for the sidebar. All I managed to do was define a width for it like this:
#sidebar {
width: 200px;
margin: 0;
}
but that only makes it thinner, it doesn’t shift the content over. Sorry to say you’re on your own on this one
Hi
I am also trying to use the modularity lite theme. When I select the theme option to have the sidebar as default, but then create a page in which I select the optional full page width (on the RHS of the page admin) , the semi-transparent layer behind the content area for that page becomes totally black.
The site isn’t live yet, so I cannot show you, but I have googled others who had this same issue, but no fixes.
Do you have any idea?
I assume it is something to do with the full width template?
I appreciate your assistance
Hi Katrina,
yes I see what you mean–
I think what’s happening is that the black area is actually the footer-wrap that gets pushed up. It usually ends at the bottom of the page. With the full width template it also eliminates the bottom widgets hence the background appears black. There’s no content area defined – let’s fix that!
Open the full-width-page.php file and insert an opening content div tag below the get_header() statement, and close the tag before the get_footer() statement. That’ll get rid of the blackness.
Here’s the amended file (copy and page may not work):
<?php/**
* @package WordPress
* @subpackage Modularity
*/
?>
<?php
/*
Template Name: Full-width, no sidebar
*/
?>
<?php get_header(); ?>
<div class="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<?php the_content( __( 'Read the rest of this page »', 'modularity' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div>' . __( 'Pages:', 'modularity' ), 'after' => '</div>' ) ); ?>
</div>
<div></div>
<?php endwhile; endif; ?>
<?php edit_post_link( __( 'Edit', 'modularity' ), '<p>', '</p>'); ?>
<?php if ( comments_open() ) comments_template(); ?>
</div>
<?php get_footer(); ?>
Hope this helps
Thanks a mil for replying.
I’ll definately give that a try.
kind regards
Katrina
Hi Jay
Is there a way to change the colour of Links when placed in the side bar… when placed in the footer the links are blue, but when placed in sidebar they are invisible? I’ve gone through the CSS and can’t find where to change it!! I’ve had to put all my links down the bottom as a footer!!
Thanks
Hi Chantal,
if by “invisible” you mean that they’re white you can redefine or amend that style. Have a look for this block of code and change the second line to the colour of your liking (#e11 is a nice red for example, but the default is #eee which is white):
#sidebar ul li a,ul.txt li {color: #e11;
height: 1%;
line-height: 1.2em;
border-bottom: 1px solid #000;
display: block;
padding: 6px 0 6px 8px;
}
To match the blue from the bottom widget area the colour code is #428CE7
Wonderful that worked!!!! 1 more question…. hehe!! Is there a way to add music to this theme?
Glad to hear it
Audio is more of a Plugin solution really so you can add this to any theme. Have a look at this list of Audio Player plugins – I’ve only ever tried Audio Player which can play an MP3 file from your site if a visitor hits a button. If you’re looking for something that plays a playlist from other sources on the web then Streampad is perhaps the one to go with.
Have fun
I can’t use plugins cause of Wordpress.com not org…. is there another way?
Ah… in that case I guess the answer it no I’m afraid
Hi, Great tips….
However, I can’t seem to successfully add the code to the index.php so that it will call my predetermined images that I put in the slideshow directory that I created. I have v 1.3 I want to have the 1.2 functionality. Does someone have a .zip file with the fixes already made. I would like to rotate 10 images that are not associated with posts, only on the main page.
Thanks!
Mark
Well, it turns out that my jpg file got renamed imagex.JPG
Yeah, ITS WORKING!!!!!
Thanks
Excellent, glad it’s working for you.
The other suggestion I was going to put in the article is the Nivo Slider – a very cool jquery slideshow code you can use to have an incredible slideshow on any of your pages. There are several plugins in the Wordpress Repository which use Nivo.
Handy to know as a backup option.
I added the fix, and everything works great in Chrome, but IE likes to stack the images, load all the other site data, and then collapse the images and start the slide effect. Do you know of a work around for this so IE (8 9) doesn’t stack the images?
Thanks!!!!!!!!!!!
Hi Mark,
There’s an expression among web developers known as IDWIMIE – it translates into It Doesn’t Work In Microsoft Internet Explorer.
Oftentimes there are hacks but if it doesn’t want to play you’re out of luck. Your two options are to live with it (not so good) or to change the item that’s not working.
If it’s only the slideshow that causes trouble, and IE support is important to you then have a look into the Nivo Slider. It’ll add a very cool jQuery slideshow to your posts and pages – they even have a Wordpress plugin (however I haven’t had the chance to try this yet). Check it out here and see if that’s something to replace the slideshow with:
http://nivo.dev7studios.com/
Hi Jay,
It’s been a long time. How have you been ?
Here is my question :
I set up my images for the slideshow at 750 x 250. The problem is that the slideshow gets displayed correctly but is not centered. Could you please help me with this ? I know that images should be at least 900 but just wondering if there is a trick for smaller images. Thanks a lot for your help
Hi Jade,
before the block you want to centre, put the tag <div align=”center”>. Then at the end, close the tag with </div>.
No guarantees that this will work with the slideshow, but give it a try.
Thanks a lot Jay, it works perfectly !!!
One more question though :
Is there a way to integrate an object/image on the left/right side of the slideshow (far left/right) in order to fill in the empty space of the main container ?
I really like your site, it looks so unlike Modularity Lite that I had to look twice
Theoretically yes, you should be able to add an image right after the opening div tag and a right before the closing one. This should add sidebar slivers to your slideshow. Make sure the images you’re using are slim enough so that they don’t screw up the design. I personally think your site looks superb without them though.
Thanks Jay for your comments on my site.
I gave up on adding sidebar slivers to the slideshow since even slim images still mess up the design.
Anyway, I was wondering if you new a tip regarding browsers because my site is not displayed the same on Mozilla, Explorer or Chrome. I use Google Chrome by the way.
Thanks for your help.
Pass I’m afraid,
getting all browsers to display the same way is a dark art, one of which I’m not a master. Others call it impossible. As a general rule I would ignore Internet Explorer to a certain degree, especially versions 6 and 7. They just don’t want to play ball. Firefox and Safari generally work similar, and they’re preferred browsers for testing. Chrome is an exotic new child with intricacies.
Ok, Thanks anyway.
I’m gonna bother you again.
How could I reduce the gap I have :
- between the bottom of my page and the text “Theme: Modularity Lite by Graph Paper Press”
- between “Theme: Modularity Lite by Graph Paper Press” and “© 2010 Corée Voyage” (which is a text widget I have placed in footer 1)
Thanks for helping !
To reduce the amount of space in the footer at the copyright line, find this block in style.css:
#footer {width: 950px;
padding: 1.5em 0;
margin: 0 auto;
color: #999;
text-align: left
}
Take out the padding line and you’ll see a significant drop there, or adjust it to the size you like. You can also use an amoun of pixels (like 5px).
The other space before the footer looks like it’s created by your sidebar being too long for the amount of posts you display. You can either add another post at the bottom or take out one of the widgets. I would also think about adding your own copyright line in front of or before the Modularity copyright in footer.php – makes it look a bit tighter.
Hi Jay,
Which code do I have to use to add my own copyright line in front of or before the Modularity copyright in footer.php ?
I have the following code :
<?php printf( __( 'Theme: %1$s by %2$s.' ), 'Modularity Lite', 'Graph Paper Press‘ ); ?>
Where exactly do I have to put my code ?
Ah yes, that does look rather complicated doesn’t it? It does this so that translaters can replace the values – which makes modding a litle bit more tricky. The same line could be expressed as this:
Theme: Modularity Lite by Graph Paper Press.
If you replace the complex PHP statement with this code, I’m sure you know what to do
← Previous Comments
Next Comments →
{ 1 trackback }