Archive

Posts Tagged ‘Mimbo 2.2’

Modifying Mimbo 2.2 Step Three – Changing image handling

September 2nd, 2008

This is the third in a series of articles that will cover making several modifications to the Mimbo 2.2 Theme by Darren Hoyt.  I am modifying the theme to fit the requirements for my own site.  To see the first step requirements and get an overview of what I have planned, please read The first article in the series; Modifying Mimbo 2.2: Step One – Identifying Requirements. For the methods used to modify the way the theme handles output in various places, check the second article in the series; Modifying Mimbo 2.2: Step Two – Modifying index.php. This article focuses on modifying the way Mimbo pulls images for the lead and secondary articles on the main page.

Darren Hoyt's Excellent Mimbo Theme

Darren Hoyt's Excellent Mimbo Theme

As I mentioned in the first part of this series, I wanted to change the way Mimbo handles it’s images to better suit my work flow.  By default, mimbo stores it’s main page images under the theme folder in a folder named (appropriately enough) images.  Using this method requires that the user has to find an alternate method of uploading his or her image files, which to me is counter-intuitive.  My solution is to store the images in the standard WordPress manner and upload them using the “Add media” dialog.

This might sound inefficient, but for me, the ability to simply paste the image url into the proper custom field makes things much more pleasant, especially when I’m trying to get several posts knocked out in one session.

The default Mimbo code for the “Featured” image is as follows:

<?php
// this is where the Lead Story module begins
   query_posts('showposts=1&cat=3'); ?>

    " alt="" id="leadpic" />


    

The important piece of code in this instance is in the image call where Mimbo’s creator hard coded the image location:

< img src="<?php bloginfo('template_url'); ?>/images/<?php
// this is where the Lead Story image gets printed

by simply removing the hard coded file location, we can now add our images in the normal way and simply paste the url into the custom fields we’ve created to handle them. In my case these fields were lead_image and secondary_image respectively.

That’s as simple as it gets, script kiddies! with just a few tweaks, you can easily take Mimbo from this:

Darren Hoyt's Excellent Mimbo Theme

Darren Hoyt's Excellent Mimbo Theme

To this:

Pretty nifty, huh?

Pretty nifty, huh?

If you’re thinking to yourself… “Hey, there are a LOT of modifications here!” You would be absolutely correct.  Unfortunately these are out of the scope of what I set out to do here, and I’m not going to get into them. Truth be told, I didn’t do anything that difficult, even for a WordPress theme novice.  All of the information you need to get the job done is in the WordPress Codex or on various sites areound the Internet.  There really is no reason for me to go over them again.  I’ll leave it up to you as an excercise in coding.

I do hope that some of the information provided here proves useful to someone.  If so, drop me a comment and let me know!

Happy Coding!

Jerry WordPress Themes , ,

Modifying Mimbo 2.2: Step Two – Modifying index.php

July 27th, 2008

This is the second in a series of articles that will cover making several modifications to the Mimbo 2.2 Theme by Darren Hoyt.  I am modifying the theme to fit the requirements for my own site.  To see the first step requirements and get an overview of what I have planned, please read The first article in the series; Modifying Mimbo 2.2: Step One – Identifying Requirements

Without further ado, let’s dive into the code for Mimbo’s index page and make some changes.

As mentioned in the first article of this series, one of my first requirements is to use category names to pull posts out of the DB instead of the default setup used by Mimbo.  This isn’t a complicated change, but when there is the possibility of category ID’s Changing over the course of a development cycle, it’s one worth making.  To make this modification, we first need to find the section of code that calls Lead Story and modify it to suit our new requirements.

Again, this is where Mimbo shines, since we find the first module right at line 6 of the index.php file:


    " alt="" id="leadpic" />

{More»}

Line 8 is the one we need to take note of.

query_posts('showposts=1&cat=3'); ?>

This call uses the query_post() WordPress Template Tag to get 1 post from category number 3. What I want to do is get the category information by name, in this case, I want to display the latest post in the “Recipes” category, so we’ll change it to read as follows:

query_posts('showposts=1&category_name="Recipes"'); ?>

The next call to a category ID is at line 16, where the category title is displayed:

// this is where the name of the Lead Story category gets printed
wp_list_categories('include=3&title_li=&style=none'); ?>

Unfortunately, wp_list_categories does not allow for calling categories by name, But since we’re already specifying the ctegory that we want by name, we can actually eliminate the need for a php call and simply print out the name using standard html, like so:

// this is where the name of the Lead Story category gets printed
?>Recipes

In the case of the project I’m working on I don’t think it’s necessary to print anything at all, since it’s going to be pretty obvious that what the reader is looking at is going to be a recipe, so I’ve made the following changes, starting at line 13:


Note: I’ve only commented these lines out in the example so that line numbering is not affected. In my production site, I removed them from the code altogether.

The second change needed to match my requirements is that all posts must show author information and date posted. This is required by several of my advertisers so that they can keep track of the dates that ads and reviews were posted. I really like to keep the people that make me money happy, so I’m going to add it in.

I want the author and date information directly under the title of the post, so I’ll start adding it in at line 19:

Original Code:

// this is where the title of the Lead Story gets printed
the_title(); ?>

And we change it to:
// this is where the title of the Lead Story gets printed
    the_title(); ?>

    By   •  • Category: 

What we end up with is this:

The layout works, but it's not pretty. It'll look better once images are added and a little css work is done

As you can see, we now have no category title and we've got author information posted below the post title using the <small> tag. It's ugly as heck, but all that will be fixed later when I modify the stylesheet to fit the look that I want. What we've got is working, and I call that so-far so-good. At this point we need to modify the second column to work in the same manner. Since we've already covered the changes needed in detail, I'll just show you the code before and after modification, you should easily be able to spot the changes: Original Featured Column:


Modified Featured Column:

Recent Recipes

The only real difference between the first examples is at line 36 of the modified code:

    query_posts('showposts=5&category_name="Recipes"&offset=1'); ?>

Take note of the offset parameter. Since we're using this column as a continuation of the Recipes category and we've already displayed the first, or newest, post in the category, we use the offset parameter and set it to 1. This tells query_posts() to skip the newest post in this category and move on to the next, thus avoiding a duplicate entry.
The other main addition to the original Mimbo code is that I added post excerpts to the second column so that my readers get a glimpse, or teaser, of what the post contains. I've found that this can, at times, persuade a casual passerby to move a little deeper into the blog to find what he or she needs, and again adheres to the requirements of some of the companies that pay me to do what I do.
Modifying the third column is much the same as the first two. with just one exception. By default Mimbo uses an array of integers to get the first post in any number of categories specified and display them in that column:

I just switched the code up a bit to use category names so that all the sections matched:
// this is where you enter the IDs of which categories you want to display
$display_categories = array("Reviews","Product Spotlight", "Blog Events", "Shopping Alerts", "Blog Spotlight");
foreach ($display_categories as $category) { ?>
all I did was change the array to hold category names instead of ID's. After that, changing just the "cat=" parameter to "category_name=" was enough to let the theme do the rest. Easy Peasy! I think that's enough to digest for now. In the next article I'll address modifying the way Mimbo handles images on the main page. Have fun coding!

Jerry WordPress Themes , , ,

Modifying Mimbo 2.2: Step One – Identifying Requirements

July 21st, 2008

The time has come for a major revision to my cooking and recipe blog and I’ve chosen Mimbo to act as the basis for the redesign.  This is the first in a series of articles that will detail the changes I’ve implemented to get Mimbo working the way that I need it to.

There are few WordPress themes that have garnered as much interest as Mimbo 2.2 by Darren Hoyt. Not only is the layout elegant and very functional, the code is commented well enough to allow anything from minor tweaks to major customizations without much trouble at all. This ease of customization is a major component to Mimbo’s success and in my opinion it is also Mimbo’s strongest point.

As with any theme modification, steps need to be taken in advance to know what your requirements are.  In this case, Mimbo’s layout is nearly everything that I want for the new look, but there are some very real changes that I need implemented.  Styling is almost always a more significant time investment, so it’s best to decide early on if the project will have to be switched to another theme. Before worrying about new header graphics of mucking with CSS styles, it’s necessary to map out the core functionality necessary for your specific needs and make sure that everything is functioning in the way that you need it to. This can save hours in development time.

With that in mind, let’s look at the way that Mimbo functions “out of the box”.

Darren Hoyt's Mimbo. As a theme, it's a work of art

Mimbo has four main “Modules” on the index page. (The sidebar has multiple modules, but I’ll focus on those in a later post) Each of these modules displays the latest information from different defined categories in whatever order the blog owner prefers. Let’s look at each in turn and see how the theme author has this laid out.

  1. The Lead Story Module: Designed to handle important news, or the most relevant piece of “core content” of your blog.  It puts it right out there in front of the world at twice the width of anything else on the page.
  2. The “Features” Module: a chronological listing from the “Featured” category.  Generally the column where important “bread and butter” articles would be featured.  Again this targets your core content, but it’s content of a less immediately relevant nature than the Lead Story.
  3. The Right Column Module: The right column module displays the latest article posted in any number of assigned categories.  This is really the feature that puts Mimbo firmly in the “Magazine Style” WordPress theme category, and it is a very powerful tool which shows the casual visitor a brief overview of the topics you’ve been covering.
  4. The Sidebar Module: Mimbo’s sidebar contains all of the usual suspects for a WordPress theme. It has Widget support, categories, and recent this-or-that in place right out of the box.  It also has a few custom pieces like another module for displaying very short snippets of site news and advertising space built in, which just ads another level of power to this theme.

If you’re just looking for a theme that looks great and works flawlessly, Mimbo is good right off the shelf.  Unfortunately, it’s almost never that simple. Every blog or website has its own special requirements and even as good as Mimbo is, it’s just not quite what I need at this point.

The first change I need to implement is in modules 1 and 2.  For my needs, both of these modules needs to display information from the same category. They also need to display the date the post was published and a few other bits of information, such as a spoiler (or excerpt) and author information.

Module 3 is already set up much the way I need it, so the basic functionality does not need to change, but there are some formatting issues that need to be addressed. As with Modules 1 and 2, I need the date published, a better excerpt and author information shown on the main page.

In addition, I want to change the way Mimbo handles some of it’s main display functions to better suit my work flow and the fact that I’ll be importing a live site into a test environment more than once during the build process. This could change the category ID’s on me while I’m testing, and that’s just not a great way to play.

In the next installment, I’ll dive into the code changes necessary to accomplish this first round of goals.  Hopefully it will give a better understanding of theme tweaks in general and allow those of you who have always wanted to mess with your theme files to take the leap into true customization.

For my more experienced readers, perhaps it will persuade you to play around with Mimbo and see if it suits your needs as well.

Until next time!

Jerry WordPress Themes , , , ,

ss_blog_claim=3928b73221a2ea923abbd6c5cb76831e ss_blog_claim=3928b73221a2ea923abbd6c5cb76831e