scriptygoddess

21 Oct, 2004

The redesign of Pixelog.org

Posted by: Jennifer In: WordPress Hacks|WordPress: Lessons Learned

One of the things that drove me to WordPress was the fact that it was PHP based. It leaves the doors wide open for you to do practically any kind of hack you could possibly think of.

I recently reworked Pixelog.org for Christine. The original was a table based design, powered by MT. Now it's all CSS based, valid XHTML 1.0 Strict, and powered by WordPress!

However, to get everything to work just so I had to pull a few tricks….

1) Browser resizing
Christine couldn't decide between a horizontal layout which she preferred, or a vertical one (which would be more "smaller browser" friendly. So, we did both! I used the getBrowserWidth() javascript that The Man in Blue used for this sample for resolution based layouts, and some of the javascript mentioned here. The end result, while not as fancy as The Man in Blue's – it does the trick. Each time the browser is resized, the screen is refreshed, and the stylesheet appropriate for your browser width is loaded.

2) Extract just what you need
Pixelog.org is already a few years old. Back then, we hardcoded awful things like borders, styles inside the img tag itself. I REALLY wanted the site to validate, but there was so much junk in the posts and img tags, and with 230+ posts, there was no way we were going to be able to edit everything and clean it up. Since the "main" part of the post was being handled one way, and the "more" part of the post completely seperate, I was going to have to access the "raw" data anyway.

So, to get JUST the "main" part of the post I did this:

$content = explode('<!–more–>', $pages[$page-1]);

then to extract just the url to the image, Matt gave me this little code snippet:

$jpg = preg_replace('/.*(http:.*?.jpg).*/i', '$1', $content[0]);

now I can reconstruct the URL and make it a clean img tag:

echo '<img src="'.trim($jpg).'" alt="'.$post->post_title.'" />';

Then, where I wanted the "more" to display, I did this:

$content = explode('<!–more–>', $pages[$page-1]);
echo apply_filters('the_content', $content[1]);

(note: By doing things this way – you may bypass some of the other filters wordpress does! So, while this worked for this particular situation, as they say "your mileage may vary!"

3) Category view on it's own page
I wanted to keep the cateogry page on a completely different page as the rest of the site. We're not using the "nicer" permalinks, so I set up a redirect based on the query string in the url. This is on the index page:

<?php
if (isset($_GET['cat'])) {
$url = "/catview.php";
if (isset($_SERVER['QUERY_STRING'])) {
$url .= "?".$_SERVER['QUERY_STRING'];
}
header("Location: ". $url);
exit;
}
?>

"catview.php" is the category page. On that page I have this code at the top:

<?php
if (!isset($_GET['cat'])) {
$url = "/index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$url .= "?".$_SERVER['QUERY_STRING'];
}
header("Location: ". $url);
exit;
}
?>

4) Pixelog on BigPinkCookie
The last trick was getting the thumbnails from the most recent pixelog posts to show up on Christine's main blog BigPinkCookie. The nice thing is that since they're both now powered by wordpress and are in the same database (just with different table prefixes), we already have a plug into the database we need. Again, it's a matter of getting to the raw data. I get the excerpts (which have the thumbnails in them) like this:

$pixelog = $wpdb->get_results("SELECT ID, post_excerpt FROM PREFIXHERE_posts WHERE post_status = 'publish' order by post_date desc limit 10");

Then I go through each result like this:

foreach ($pixelog as $v) {
echo "<li class='pixelogborder'>
<a href='http://www.pixelog.org/index.php?p=".$v->ID."'>" .
$v->post_excerpt .
"</a>
</li>";
}

Update: I should probably add, the way Christine is entering her posts to get this to work; Thumbnails go in the excerpt field. The main photo goes as the "main" part of the post. And her "notes" go in the "more" part of the post.

14 Responses to "The redesign of Pixelog.org"

1 | wordlog.com » Pixelog - Excellent WP photolog

October 22nd, 2004 at 10:47 pm

Avatar

[…] Excellent WP photolog
Filed under: Beautiful Blogs — Carthik @ 6:47 pm

ScriptyGoddess writes about her red […]

2 | Marathon Lauflog » Automatische Thumbnails?

October 29th, 2004 at 5:40 pm

Avatar

[…] matische Thumbnails eine feine Sache. Inspiration zur Umsetzung habe ich auf der Seite von Jennifer gefunden. Thumbnails go i […]

3 | Big Pink Cookie

October 21st, 2004 at 11:43 pm

Avatar

Pretty Pixelog!
Now introducing the NEW and IMPROVED Pixelog!!!

Mad props to Jennifer for many hours of hard work – she has truly made my dream a reality. I'll share more of what went on behind the scenes with the site tomorrow, but for now I just had to share th…

4 | khaled

October 22nd, 2004 at 1:52 am

Avatar

Just wanted to say that it really looks brilliant. Very clever way of including both horizontal and vertical types of websites into one.

5 | Carthik

October 22nd, 2004 at 6:42 pm

Avatar

WOW!

Is there anyway lame designers like your's truly can get the modded WP?

It's truly amazing. Must be about the best photolog I've seen, designed around WP!

6 | Jeremiah

October 22nd, 2004 at 7:53 pm

Avatar

Heads up!

the latest Firefox nightly has disabled the reload on resize functionality.

see here: Burning Edge And here: Bugzilla

Neat Design Regardless.. Kudos.

7 | seth

October 22nd, 2004 at 9:41 pm

Avatar

thanks for making me drool all over my keyboard. I have been wanting a photoblog for a few months now and I cant find anything that I dont have to code my self. anyone got any suggestions?

8 | Marie Braden

October 27th, 2004 at 2:38 pm

Avatar

Wow, that's GORGEOUS…. how could someone do something similar on one's own blog? I LOVE that you did it up seperate….

9 | duncan

October 29th, 2004 at 10:34 pm

Avatar

please please! share the code!

10 | Jennifer

October 29th, 2004 at 10:38 pm

Avatar

Duncan – that's what this post was all about :) All the major hacks I did to get the site to work – are right there. Was there something else I left out?

11 | duncan

October 30th, 2004 at 11:53 pm

Avatar

really? thats it? (im not a programmer at all?) i have WP setup, pretty outta the box, but really like the photo blog setup you have going. is it these couple snips and a layout that make it work like it does? it just look so different (design aside) in terms of layout, nav etc.

12 | Just Lookin'

November 13th, 2004 at 2:02 pm

Avatar

ScriptyGoddess and Pixelog.org
I've been fascinated with pixelog.org – such a beautiful, elegant, simple and generally delightful site. I found this link on scriptygoddess . One of the things that drove me to WordPress was the fact that it was PHP based. It…

13 | David Clark

December 4th, 2004 at 11:29 am

Avatar

Jennifer — this is a great tutorial. Are you playing with 1.3 yet? I think this can be made even easier.

14 | Jennifer

December 4th, 2004 at 10:43 pm

Avatar

I have played around with 1.3 a bit. It looks very cool, and I'm anxiously anticipating the final release. Because there are a several "customizations" I do to my blogs, upgrading is a bit of a hassle. (Long term plan is to reduce the number of customizations – well at least the ones that make upgrading a hassle – and I think with 1.3 that I will get closer to that) So rather than keeping up to date with the latest build, I'm holding off making the big jump for when the final version is out. This way I only have to make those customizations once…

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements