Sayontan

Sayontan Sinha is a technology strategy consultant living in Houston, Texas. Coding is his hobby, as are philately, numismatics, classical music, creative writing and quizzing. He is the author of numerous pieces of WordPress software, including the ultra-popular Suffusion WordPress theme and the versatile Photonic (for Flickr, Picasa, Smugmug and 500px.com integration) and FontMeister.

Feb 152010
 

Version 3.3.4 was released today with the following changes:

  1. Fixed a bug with the AdSense short code. The short code should now work perfectly
  2. Fixed a bug where the default post thumbnail, if used in an excerpt, was not linking back to the original post
  3. Fixed a sidebar positioning issue with the “Single Left and Single Right Sidebar” template, where the settings for the sidebar positions were being ignored
  4. Changed the Twitter widget’s tweet icon to a comment bubble instead of a bullet
  5. Added a new Estonian translation (et.po and et.mo), thanks to Viljar Hera!

I had bigger plans for this release, unfortunately I have been suffering with a neck and shoulder injury which cripples my ability to type.

Feb 132010
 

One thought I have been wrestling with since the past few weeks is a redesign of the options menu in Suffusion. While the options page is ultra-powerful in terms of what it can do, it looks rather overwhelming. I am not a big fan of the long list of options that shows up when I click on a tab in the menu and I would dearly love to make it cleaner. If only I could come up with a better solution!

When the options in Suffusion were a lot fewer (think release 2.0.x) the interface was perfect. But as the power of the theme grew, so did the list of options. And it becomes particularly taxing on the eyes of the administrators who have to change the options. There is something that is stopping me from changing the structure of the options page and that is the fact that it is incredibly easy to code it up the way I have it. I started a handful of tutorials on how to write a theme options page a few months back. In that you can see how absolutely easy it is for me to add new options, given the modular structure of my code. I simply need to figure out the option type, provide some option values for it and bingo! The processing code is very straightforward and it automatically picks the options and formats them as appropriate.

But as is the case very often, what is easy to code is not necessarily easy to look at. I did a good bit of redesigning during Christmas last year and came up with two sets of tabs, a horizontal set of tabs for high-level grouping and a vertical set of tabs within each horizontal tab. This at least made the vertical list look a lot smaller. But as I continue to add options, that page is again threatening to look daunting. So what do I do now?

I looked around to see how some other themes do this and here is what I saw in two really good themes:

Atahualpa WordPress Theme

The Options Page of Atahualpa

Constructor WordPress Theme

The Options Page of Constructor

Suffusion’s options look to a large extent like Atahualpa’s. However, given Atahualpa’s incredible number of options it too probably faces the same fate as Suffusion to a degree. Where it does gain an edge is in the fact that it uses pictures to illustrate what it is talking about and doesn’t rely on text like Suffusion does. I will be the first to admit that Suffusion’s options are verbose.

The other theme presented here is Constructor. If I were to use one word for the options page for Constructor, that word would be lovely. Its options are much fewer in number than Atahualpa’s or Suffusion’s, but the page is truly nice looking. It makes liberal use of JQuery, and is the perfect advertisement for the adage, “A picture is worth a thousand words”. But here is a catch – every option has been manually coded. This is fine with a small set of options, but it will require an effort of Herculean proportions if I were to adopt that approach for Suffusion.

My feeling is that the options page should be something in between the two styles. If I could figure out a way to automate the generation of pages like Constructor’s, that would be perfect. What do you think? How do you feel I can move to a structure more like Constructor’s?

Feb 122010
 

Version 3.3.3 was released today with the following features / fixes:

  1. New Widget Area
    There is a new widget area now called Left Header Widgets, to the left of the main navigation bar. I have currently positioned this at the bottom of the widget area list in the admin menu, but I will move it up after a few releases. This brings the current total number of widget areas to 8 – soon reaching double figures!!
  2. Removed the option “Enable Widget Area on right side of navigation bar”
    This option caused more hassle than it was worth. Now if you simply set “Show Search in Widget Area on right side of header” to hidden, this widget area will be hidden. Hopefully this will resolve issues about the navigation bar spilling into two rows.
  3. I have put in some tweaks to automatically size images to fit in your post windows. Hopefully you will not have to go through the painful process of resizing your post images.
  4. I added a call to “language_attributes()” to the document header. This will ease integration with FaceBook.
  5. Bug Fixes
    I had inadvertently put in a major bug in 3.3.1. That has been fixed. I have also gotten rid of a “locking and popping” issue on IE7, making the theme much more responsive there.
Feb 122010
 

As the adage goes, “A bad workman blames his tools”. So let me start off by saying that my IDE went aggressive and did something I didn’t mean for it to do. In my zeal for being semantically correct I renamed a file called sidebars.php to widget-areas.php and inadvertently changed all strings of code referencing “sidebars” to “widget-areas”. As a fallout, the string “no-sidebars.php” became “no-widget-areas.php", but the file name remained no-sidebars.php. Ditto for other templates. The result is that people using specific column templates to this date suddenly have had their column templates break.

I fixed this problem and submitted the correction in 3.3.3 a few minutes back to WordPress, but in the meanwhile if you are using a specific column template, please move down to a lower version, like 3.3.0. You can download it here.

As a person who spends a good deal of time coding this, I fully sympathize with the time and effort this might have cost you. Terribly sorry for the same.

Feb 112010
 

Version 3.3.1 of Suffusion was approved a few minutes back. This has some quite significant features:

  1. Export / Import Theme Options
    This is quite big. Though this was not on my immediate agenda, some unsavory incidents on the support forum during the weekend precipitated this fix. This feature is going to be a must if you are running several blogs and you want to replicate the settings across them. 
    You can go to Suffusion Theme Options –> Introduction –> Export / Import to see this. You can export your current theme settings as a file called “suffusion-options.php”, then copy it to the folder called “import” under suffusion/admin/ in your new blog installation, then click “Import” on your new blog installation.
    All your look and feel settings plus blog features etc will be copied over. What will not be copied over is the list of pages / categories / links you have selected in one installation, because the page ids may be different between your installations.
  2. New Widget Areas
    The Top Navigation bar has two widget areas – one each on the left and right. You can add small widgets to these widget areas to enhance your site’s look.
  3. You can now choose alignment options for the drop-down menu in the top navigation bar – left or right.
  4. Code Housekeeping
    I made a small tweak to the code for the search widget. Earlier I had set it up such that if the “before_title” and “after_title” elements of the widget’s definition were empty, the title wouldn’t print. I have reversed the condition – if the title is empty, the “before_title” and “after_title” elements will not print. I have also added a function that checks if a widget area has any widgets associated with it. If it doesn’t, the widget area is not printed.

Up next, a few more widget areas.

Feb 102010
 

Version 3.3.0 was released earlier today. Actually the original version I had submitted was 3.2.9 and it had a really wonderful feature, but I had to pull that feature after the WP reviewer pointed out that it could pose a security risk. So here is the list of features:

  1. Mixed mode layout
    One of the features that had been requested was the ability to display full contents for the top x posts and excerpts for the subsequent posts. I am happy to say that this release features this capability. You can have full contents displayed for a handful of posts and show excerpts, lists or tiles for the remaining posts on that page. You can control the settings via Blog Features –> Excerpts / Full Contents
  2. I have deprecated a few options: "Category Info in ‘Display List’ option", "Author Info in ‘Display List’ option" and "Tag Info in ‘Display List’ option". You can use the controls in the individual templates for Category, Author and Tag respectively instead.
  3. There is now a new control to display the tag description in the Single Tag template. Earlier you couldn’t see the description.
  4. Fixed minor bugs in the “List” layout
  5. I cleaned up some code for the different layouts, making things a lot more streamlined behind the scenes.
  6. Thanks to Harry Karayannis, the Greek translation of Suffusion is now 100% complete.

Now for the feature that I had to pull. I had provided a really cool short code that would let you execute any PHP function as a short code. However I have had to remove that call, because in a multi-user blog you could have unauthorized people with author privileges call admin functions unchecked. If you are running a personal blog you can create the short code yourself, though. To do this, add the following PHP code to functions.php:

function sc_php_function($attr) {
    $function = $attr['function'];
    $params = $attr['params'];
    $params = explode("||", $params);

    if (is_callable($function)) {
        $ret = call_user_func_array($function, $params);
    }

    return $ret;
}

add_shortcode(‘php-function', 'sc_php_function');

Cheers.

Feb 082010
 

Version 3.2.8 was released a couple of hours backs, with a bunch of modifications:

  1. New Short Codes
    You now have two new short codes. The first is “suffusion-adsense”, which takes the parameters client, slot, width and height, and prints out the ad corresponding to these parameters wherever invoked. You could call it in the middle of a post to see the ads in there, or you could call this in the widgets. The second short code is “suffusion-tag-cloud” and it prints out your tag cloud. It takes all parameters of the wp_tag_cloud() function and you can use it to print a tag cloud in your text widgets with the font sizes you wish and change the number of tags displayed there from 45 to something else.
  2. New Tiles Layout
    The previous release had a “List Layout” and this one has a new “Tiles Layout”. This is analogous to a magazine layout enabled for different types of views – category, tag, search etc. See the new options in “Excerpts / Full Contents” under “Blog Features”
  3. Fixes and Modifications
    If you were to use the new templates I provided in version 3.2.5 (Single Left Sidebar etc) you would have noticed some discrepancies in the drag-and-drop behavior. If you haven’t noticed those, it simply means I have beaten you to the bug and fixed the issues ;-) . I also made pages included in Featured Content order by menu_order. Lastly I had made a “Programming 101” error in one of my fixes in 3.2.7 and put in an erroneous “if” condition in the “Follow Me” widget. Thanks to Wim Scholtes’ alert eyes this has been fixed.
  4. Updated Translations
    I received updated translations from Didier for French, Manfred for German (Du) and Connie for German (Sie). So along with Wim’s Dutch translation, Team Blogos’ Danish translation and Memoria’s Spanish translation, these are the new ones that are 100% translated. Thanks folks!

I would like to reach out to the other folks who can translate. The following translations are out of date and could use your help:

  1. Arabic – ar.po, ar.mo, 47% translated
  2. Catalan – ca.po, ca.mo, 25% translated
  3. Greek – el_GR.po, el_GR.mo, 85% translated (Harry has said he will translate the remaining strings)
  4. Norwegian – nb_NO.po, nb_NO.mo, 88% translated
  5. Brazilian Portuguese – pt_BR.po, pt_BR.mo, 90% translated
  6. Portuguese – pt_PT.po, pt_PT.mo, 38% translated
  7. Swedish – sv_SE.po, sv_SE.mo, 41% translated.

The ones with less than 50% translation need some attention. Also I would like to welcome translations for other common languages like Mandarin and Russian.

I realized that with some of the changes I made over the past few releases some aspects of the RTL layout may have broken. I will work on fixing those soon.

Feb 052010
 

Suffusion Version 3.2.7 was released today. The following key features are a part of this release:

  1. Favicons
    After having been asked umpteen times about Favicons, I finally bit the bullet and decided to offer integrated Favicon support with the theme. Mind you though, all modern and arcane browsers (up to Internet Explorer 4) are capable of dealing with a favicon.ico file in your root directory / other directories. However, given the frequency of the question I finally added explicit support for it.
  2. “List” Display
    In keeping with my goal of multiple layouts I have built out the capability to show a “list” of posts instead of full content or excerpts. You can set this up through the “Excerpts / Full Contents” options.
  3. Bug Fixes
    There are two bug fixes. The first was causing the thumbnail container in the magazine layout to appear irrespective of the settings. The second was not a bug per se, but it was an incompatibility with certain paranoid hosts that was causing the “Follow Me” widget to error out. Thanks to Wim Scholtes, that has now been fixed.

I have received some translation updates that I will include in the next version.

Feb 042010
 

Update: With release 3.7.5, the path to the options is Suffusion Options → Back-end Settings → Custom Includes.

Update: With release 3.4.2, the option group below is no longer called “Custom CSS, JavaScript & RSS”, but it is called “Custom Includes”

I decided to take a pause from my breakneck development and highlight one of the best, and most understated features of Suffusion – Custom Styles. The inspiration for this article is one of the most frequently asked questions that I get:

When I clicked on “Upgrade” I got a message saying that all my changes will be overwritten if I upgrade. Is this true? I don’t want to lose hours of work that I put in to customize my site.

The answer to this question really lies in qualifying “hours of work”. If you have spent the hours modifying the CSS and PHP files in Suffusion, then you are out of luck. You will indeed lose hours, which is a shame because all your CSS changes are absolutely unnecessary.

Seasoned users of Suffusion are probably aware that you can customize your installation of Suffusion almost as you please and not lose any settings when you upgrade. This post is directed towards users who aren’t sure about how to do this. The concept is really, blindingly simple. But before that you need a couple of tools:

  1. A nice standards-compliant browser, preferably Firefox or Chrome. Though there are other standards-compliant browsers, I would recommend these because of the wealth of extensions.
  2. At least one of these Firefox extensions, if you are using Firefox: Firebug or Web Developer. Both tools are awesome, though I have a slight preference for Firebug because it seems more concise. If you are using Chrome, you are good to go because Chrome offers an inbuilt feature called “Inspect Element”, which you can see upon doing a right-click on any page element. For people with difficulties switching to the better browsers and still stuck with IE, IE has an extension called DebugBar.

You also need to have rudimentary CSS knowledge, which in the days of Internet excesses, can be readily obtained at W3 Schools. And for some serious CSS stuff, there is a set of CSS tutorials at 456 Berea Street that is just phenomenal. Armed with the tools and knowledge, here is what you need to know:

You don’t need to edit ANY CSS file to change the look and feel in Suffusion.

Yup. Instead, do this. Navigate to Suffusion Theme Options –> Blog Features –> Custom CSS, JavaScript & RSS.

custom-styles

There you will see an option called “Custom Styles”.

custom-styles-2

That is where you can put in all your CSS tweaks. This block is called last when Suffusion is being loaded, so if you want to override any of the theme’s styles your best bet is to put in the styles here. Of course, you might have a plugin that does its own fancy things and overwrites Suffusion’s styles, and if that is the case then you will need to badger the plugin’s author for information about changing a style definition. But for everything else, this little option will suffice.

Let me walk you through this with a little example. To start with, I have enabled the “Top Navigation Bar” on this page. Here is how it looks by default:

custom-styles-3

This doesn’t go very well with the overall transparent look of this site, so I will make the background of the top navigation bar transparent. Without editing any of my theme’s stylesheets. First I will make use of Firebug. Installing Firebug adds an item to the context menu – “Inspect Element”. So I can right click on the navigation bar and inspect it:

custom-styles-4 Here is what Firebug shows me:

custom-styles-5

So the element is called “#nav-top”. Now I do some CSS magic in the Custom Styles:

#nav-top {
        background: transparent;
        border: none;
}

This makes the background transparent and removes the border:

custom-styles-6
Much better, but I want some rounded corners for the first and last items. But what do I need to modify? Again, Firebug comes to the rescue. I right-click on “Themes” and inspect the element:

custom-styles-7

OK, so inside #nav-top there is a div with class “col-control”, inside which there is an unordered list (ul) with class “sf-menu”, which obviously has a list item (li) with the links to the pages in the menu. This is a lot of information, but luckily we don’t need to know so much. The good thing about CSS is that the rules and structures are cascading, so I don’t need to call the interim levels if I can avoid it. This is what I add to my custom styles:

#nav-top ul.sf-menu li,
#nav-top ul.sf-menu li > a,
#nav-top ul.sf-menu li > a:hover {
        border-bottom-left-radius: 5px;
        -moz-border-radius-bottomleft: 5px;
        -webkit-border-bottom-left-radius: 5px;
        -khtml-border-bottom-left-radius: 5px;
}

#nav-top ul.sf-menu li,
#nav-top ul.sf-menu li > a,
#nav-top ul.sf-menu li > a:hover {
        border-bottom-right-radius: 5px;
        -moz-border-radius-bottomright: 5px;
        -webkit-border-bottom-right-radius: 5px;
        -khtml-border-bottom-right-radius: 5px;
}

This works, but a bit too well, unfortunately, rounding off all the corners:

custom-styles-8Here the articles from Berea Street come really handy. All I need to do is define the bottom left corner for the first list element and the bottom right corner for the last CSS element:

#nav-top ul.sf-menu li:first-child,
#nav-top ul.sf-menu li:first-child > a,
#nav-top ul.sf-menu li:first-child > a:hover {
        border-bottom-left-radius: 5px;
        -moz-border-radius-bottomleft: 5px;
        -webkit-border-bottom-left-radius: 5px;
        -khtml-border-bottom-left-radius: 5px;
}

#nav-top ul.sf-menu li:last-child,
#nav-top ul.sf-menu li:last-child > a,
#nav-top ul.sf-menu li:last-child > a:hover {
        border-bottom-right-radius: 5px;
        -moz-border-radius-bottomright: 5px;
        -webkit-border-bottom-right-radius: 5px;
        -khtml-border-bottom-right-radius: 5px;
}

This looks much better, excerpt for one minor quirk – the first elements in all lists have rounded corners:

custom-styles-9So we need to tell the code to only pick the first and last children of the top level list. Again, this is done easily using the “>” selector in CSS (refer the Berea Street link above):

#nav-top ul.sf-menu > li:first-child,
#nav-top ul.sf-menu > li:first-child > a,
#nav-top ul.sf-menu > li:first-child > a:hover {
        border-bottom-left-radius: 5px;
        -moz-border-radius-bottomleft: 5px;
        -webkit-border-bottom-left-radius: 5px;
        -khtml-border-bottom-left-radius: 5px;
}

#nav-top ul.sf-menu > li:last-child,
#nav-top ul.sf-menu > li:last-child > a,
#nav-top ul.sf-menu > li:last-child > a:hover {
        border-bottom-right-radius: 5px;
        -moz-border-radius-bottomright: 5px;
        -webkit-border-bottom-right-radius: 5px;
        -khtml-border-bottom-right-radius: 5px;
}

In the above we are telling the code to only apply the rules to the immediate children of the top level list, not nested children. The result is indeed pleasing:

custom-styles-10

No unwanted rounded corners are seen above. Now let’s say we want to add some finishing touches by increasing the space between the top level items. Again, using Firebug and basic CSS:

#nav-top ul.sf-menu > li {
        margin-right: 5px;
}

That completes the exercise and I now have the look I set out to achieve:

custom-styles-11

The good thing is that all my changes are stored in the database and not as files. So even if I upgrade my theme I am covered.

One of Suffusion’s active contributors in the support forum, Connie put together a very descriptive article on the same topic, but using Web Developer as the extension.

Feb 032010
 

Version 3.2.6 of Suffusion went live today. Hopefully people with download issues on 3.2.5 will not face the same problems on 3.2.6. The following are the changes in 3.2.6:

  1. New Navigation Bar
    Bowing to frequent demand, I decided to provide a new navigation bar!! This navigation bar occurs at the top of the page, above the header. It has drop-down menus enabled and you can add pages, categories and links to it. Currently there are no widget areas there, but that will be a new feature very very soon.
  2. Customizable 404 Page Content
    You can now set the title and content of the 404 pages to something other than the rather boring and monotonous defaults. And yes, you can use short codes there.
  3. Fixed a bug in the custom styles calculations that was not passing the number of sidebars to a function call.

As you can see, I am in the process of opening up the layout of the theme in a bid to make it more flexible. In the last release I provided a handful of new templates and here you have a new navigation bar. Soon I will add new widget areas. Soon.