Tag Archives: tutorial

SF.net PT 2: Setting up a demo site

Part 1 was easy. it’s all GUI stuff, that you can figure out by poking around. Part 2 is the reason I started writing this down. The only way to maintain your sourceforge.net website, is via SSH (and by extension, sFTP). Programs you will need:

install WinSCP, and get started!


Hosting a theme on Sourceforge, PT. 1

The advantages of sourceforge hosting are all things that all themes should have: demo blog, screenshots, download stats, nationwide download mirrors, SVN repository, bug tracker, forums. All things you could provide from your own web host, but not only would it cost a fair chunk, having bugs and support show up as comments on your blog can get to be a bit unweildy. For any GPL theme, sourceforge hosting is Free as in beer. unfortunately, getting set up on sourceforge isn’t a cakewalk. so i’m going to attempt to index their documentation in a more straightforward manner. Part 2 will explain how to install wordpress on your project’s website, to give you a fully featured demo site.

This gets a tad long

The Thin Line: From Skin To Theme

You may have noticed that i really like The Sandbox. Andy suggested a possible path for it to become the default theme, which I think would be an excellent idea. Mainly because writing PHP is not my strong suit. CSS is closer to my skill set.

WordPress versions 1.2 and below used a templating system like the one andy proposed. The problem was, the classic theme had limitations. if you wanted to remove the sidebar on post pages, as kubrick does, you were out of luck. The Sandbox would fix that. The other development that helps make templating viable again was introduced in wordpress 2.0. Since 2.0 was introduced, wordpress loads functions.php of the current theme, if it exists. this means that a theme could use only style.css and functions.php, and have an enormous level of control.

Changes to The Sandbox

it’s been a while since andy added the sandbox branch, but it doesn’t seem to be making progress. so, while i can’t implement status: hidden, i can make a workable version of The Sandbox to test The Thin Line on.

It’s been stripped of it’s skins panel (as well as the skins subfolder), had the default skin set to none, and had status: hidden added to the theme information. I also moved wp_footer(); inside the #footer div, for even greater semantic justice so that information added to the footer can be styled more easily (scroll to the end).

Changes to The Thin Line

when i said that Themes could be built on style.css and functions.php, that’s only partly true. you could build a theme that way that only inserted a footer credit, and applied javascript to the head of the theme. to add an options panel, you’ll probably want to use theundersigned’s tutorial, or ozh’s theme toolkit. I’m using theundersigned’s tutorial, mainly because the PHP is simple enough for me to get the gist of what’s going on. Ozh’s toolkit does more, but requires me to take more on faith, and has previously caused problems on the theme viewer and wordpress.com.

The first step to gluing The Thin Line to The Sandbox is this:


Theme Name: The Thin Line

Theme URI: http://archgfx.net.net/blog/index.php/themes/the-thin-line

Version: 0.7

Description: Hand on mouth, the game goes on

Author: Sunburntkamel

Author URI: http://archgfx.net/blog/index.php/about/

Template: Sandbox


That’s my entire style.css. it doesn’t need to have anything else. I’ll be using style.php for all the style information. The important part is the last line, which tells wordpress to use the template files (index.php, single.php, etc) from ‘sandbox’ to handle the content. Style.php will be loaded on top of the existing sandbox CSS, which is why we set the sandbox skin to ‘none’.


I was going to re-use the sandbox’ “skins” submenu at first, but that would require digging into the function, and renaming all the variables to use theundersigned’s $shortname converntion, and including it in the thin line, rather than the sandbox. That requires redistributing more code, which isn’t my goal. so i used theundersigned’s tutorial to make a dropdown list.

corrosponding to the dropdown list is this section of style.php, which performs roughly the same task as the skins page:

<?php if ($thethinline_layout_style = "3c-b") { ?>

@import url('skins/3c-b.css');

<?php } else if ($thethinline_layout_style = "3c-l") { ?>

@import url('skins/3c-l.css');

<?php } else if ($thethinline_layout_style = "3c-r") { ?>

@import url('skins/3c-r.css');

<?php } else if ($thethinline_layout_style = "2c-l") { ?>

@import url('skins/2c-l.css');

<?php } else if ($thethinline_layout_style = "2c-r") { ?>

@import url('skins/2c-r.css');

<?php } else { /* 1c-r */ ?>

@import url('skins/1c-b.css');

<?php } ?>

after that, style.php is just the remainder of the original thethinline.css. The advantage of styling in a PHP fileis that you can use variables, wordpress conditionals, and other assorted tricks.


Adding functionality to The Thin Line via functions.php is a little more like writing a plugin than like writing a theme. I’m using add_action(); hooks to add to both the header and footer of the theme. I could also add and remove widgets, although i don’t need to mess with the basic widget formatting, because that’s handled by functions.php in The Sandbox. Theundersigned’s tutorial needs a minor correction first, though. at the end of functions.php, I changed <?php bloginfo('template_directory'); ?> to <?php bloginfo('stylesheet_directory'); ?>. For most themes, those hooks point to the same file. This is the first time the difference matters to a theme.

Updated Footer

This is the new footer for The Thin Line. I added an image and link to The Thin Line homepage, as well as a section for users to add their own copyright notice/pithy slogan/whathaveyou (another trick i stole from scott). This is purely PHP, but it’s not scary. Just make the end of theundersigned’s functions.php look like this:

function mytheme_wp_footer() {/* Places credit link in the footer */ ?>

<span id="skin-link">

<a href="http://archgfx.net/blog/index.php/themes/the-thin-line" title="Theme by SunBurntKamel">

<img src="<?php bloginfo('stylesheet_directory'); ?>/thethinline/ttlogo.jpg" alt="The Thin Line" title="The Thin Line" /></a></span> <br />

<p class="annotation"><small><?php echo $thethinline_footer_text ?></small></p><?php }

add_action('wp_head', 'mytheme_wp_head');

add_action('admin_menu', 'mytheme_add_admin');

add_action('wp_footer', 'mytheme_wp_footer');


That’s actually probably easier than creditting yourself in footer.php I could (and may possibly) also use this function to add, say, siFR to the theme as well. Someone who didn’t ph34r javascript the way i do might add livesearch to a sandbox based theme.

The End

My point in writing all of this is to show that the idea of writing a new theme every time is overkill. Template files themselves don’t vary a lot. Most of the functionality and variation happens in javascript and CSS. those can both be handled by only a couple of files. If theme authors could depend on the sandbox being in every wordpress distribution, It would make it easier for them, as well as for casual users who just want to change something small about a theme. It’s a lot easier to find the thing to change when there are only 3 files in the Theme Editor panel of the dashboard.

theme contents

I was going to include The Thin Line with this, but i’m having a little difficulty making everything style the way it was before, and some of the variables i’ve created with theundersigned’s tutorial aren’t properly sticking, despite showing up correctly in my database.

Bookmark This:

add to del.icio.us :: Digg it :: add to ma.gnolia :: Stumble It! :: seed the vine :: TailRank

Custom CSS on wordpress.com

UPDATE: it seems that this trick doesn’t actually work all that well.  however, the pinklillies style has been painstakingly converted to a sandbox skin.  The instructions below will help you use skins that were not intended for wordpress.com, though.

Customizing CSS is a new trick on wordpress.com, but hosted wordpress users have been doing it for a while.

Alex King has hosted a competition or two based on styling the ‘classic’ theme.

Here’s how to use those great old styles:

1. download and unzip the style of your choice.
2. Go to your wordpress dashboard, and under Presentation, choose the WordPress Classic theme, by Dave Shea.
3. Start Writing a new post. Using the uploader, upload all of the images from the style you downloaded.
3a. for each image, click on it, and make sure the popup says ‘using original’ at the top. click on ‘using thumbnail’ if it doesn’t. once it says ‘using original’, click ‘close’
4. Open TextEdit on your computer
5. drag style.css from the downloaded style onto textedit
6. click Go > Find (or press cmd+F)
7. search for the name of the first image in the style folder (ex. top.gif)
8. in your new post (on wordpress.com), in the uploader, control+click on the same image, and click “copy image address”
9. switch back to textedit, and paste that address into the ‘replace’ field.

10. click ‘replace and find’. this will highlight the name of the image.
11. click ‘replace’ and the highlighted text will be replaced with the address of the image you’ve uploaded.
12. repeat steps 6-11 for all the images in the style.
13. click File > Save
14. click Edit > Select All, then Edit > Copy
15. go to the Custom CSS page in your wordpress dashboard, and paste.
16. click preview to see it in action, and click ‘save stylesheet’ if it looks good!

FULL DISCLOSURE: i don’t have a paid account. i can’t test this out.

UPDATE: wank points out that this won’t work perfectly, since classic styles are meant to replace classic, not overwrite it. example