How to style Modularity Lite 1.3 by GraphPaperPress

- by

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 http://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 punch out catalogs,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:


<?php bloginfo('name'); ?>
<?php bloginfo('name'); ?>
<?php bloginfo('name'); ?>
<?php bloginfo('name'); ?>
<?php bloginfo('name'); ?>

 

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:


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!)



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

231 thoughts on “How to style Modularity Lite 1.3 by GraphPaperPress”

  1. Hi Jay,

    All your tutorials have been overwhelmingly helpful — I really can’t thank you enough.

    I was hoping you could maybe direct me as to how I can make certain changes on my site:

    1) In the bar below each individual blog post, I’d really like it if I could eliminate all the standard data (i.e. date, category, comments) and insert some other data (i.e. “Status: Available or Unavailable”). I’ve tried fiddling around with this before, but I can’t manage to pinpoint where exactly to make the appropriate customizations.

    2) When I go to my navigation bar and click on any of the categories which drop down from “Lamps”, the category title always appears (in dark, barely noticeable font) at the top of that page. How can I eliminate that? I was able to eliminate page titles, but this seems to be a blog category title — and I can’t figure it out…

    Thanks so much!

    Max

  2. Hi Max,

    glad I could help a fellow artist. Those are some awesome lamps you’ve got there 😉

    Let me answer your first question first – the Meta Data display on Single Posts. Have a look at your single.php file and find the following code block:

    <p class="postmetadata alt" >
    <small>
    <?php
    $tag_list = get_the_tag_list( ' and was tagged with ', ', ' );
    printf( __( 'This entry was posted on %1$s. It was filed under %2$s%3$s.', 'modularity' ),
    get_the_time( get_option( 'date_format' ) ),
    get_the_category_list( ', ' ),
    $tag_list
    );
    ?>
    <?php edit_post_link( __( 'Edit this entry', 'modularity' ), '', '.' ); ?>
    </small>
    </p>

    Delete this entire block to remove the strip completely. Alternatively you could replace it with this:

    <p class="postmetadata alt">
    <small>
    <?php
    $tag_list = get_the_tag_list( 'This item is ', ', ' );
    echo $tag_list . ' | ';
    ?>
    <?php edit_post_link( __( 'Edit this entry', 'modularity' ), '', '.' ); ?>
    </small>
    </p>

    Now the strip only shows post tags – which means that if you have an item available you could tag it as “available”, and when it’s sold you remove the tag and replace it with “sold” or even “sold to Steven Spielberg”. You could even tag it as “available for $200” all from where you’d write a post for each item. The advantage is that customers can look for similarly tagged pieces: all available, all for $200, all sold to Steven Spielberg, etc.

    Let’s have a look at removing the Category headline. Have a look at the archive.php file and find this piece of code:

    <h3>
    <?php if ( is_category() ) {
    /* If this is a category archive */
    single_cat_title();

    The last line is the one that displays the category title. Remove it and it will be gone for good. Or if you’d like to being it back in the future you can comment it out by putting /* in the front and */ at the end of it (like the line before).

    Hope it works 😉

  3. Jay,

    Thank you so much for your response! Your tip on how to remove the category headline worked like a charm.

    I also followed your instructions on modifying the Meta Data bar by altering the code on the single.php file. I added the code just as you gave it to me — however, for some odd reason, any changes I made there don’t seem to impact what my blog ultimately displays. Even when I completely remove that entire segment of code, my site still continues to show a Meta Data bar below each post. Any further suggestions?

    Once again, Jay, I really can’t thank you enough for all your help.

    -Max

  4. By the way, let me not forget to tell you that I love your suggestion for adding customized tags to each of my posts as a way to notify customers of a product’s status/cost/etc. I can’t wait to get that working!

  5. Hi Max,

    my mistake indeed – the code I gave you appears in two other places in the theme with a slight variation, one is in blog.php and the other is in archives.php. This is the block you’re looking for:

    <?php
    $tag_list = get_the_tag_list( '| Tags: ', ', ' );
    printf( __( '%1$s | Categories: %2$s %3$s | ', 'modularity' ),
    get_the_time( get_option( 'date_format' ) ),
    get_the_category_list( ', ' ),
    $tag_list
    );
    ?>

    Replace the entire thing with the one I gave you earlier and you’re on to a winner. All three files are called on different occasions: single.php when you show a single post, archives.php when you’re browsing a category and blog.php when you’re using the “latest blog posts” function.

    Currently there seems to be a problem with your single.php file (when you click on the headline of a post, an error message comes up). You may have accidentally deleted a closing PHP tag or somesuch. If you run into any problems, let me know.

    Good luck 😉

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.