Mostly about my amusement

Year: 2011 (page 1 of 6)

It’s not my fault, the wife uses Internet Explorer 8

For my home PCs I typically run the latest and greatest web browsers. I even run Internet Explorer 9 which is even not that bad™. Lately I’ve been vacillating between Firefox and Chrome.

At my wife’s work they’re now using Internet Explorer 8. That’s an improvement, they’ve been on version 6 for years.

This blog’s theme uses CSS border radius effectively and it doesn’t render correctly on version 8. You get square blocks where you wanted round corners. The next version it works fine, version 8 and below not so much.

There is a work around but it’s ugly. Add conditional CSS to your head for any version of IE less than 9 and reference PIE.htc from CSS3 PIE.

This is easily done by adding some code to my theme’s functions.php file.
Read more

Ilford XP2 Super 400

One of the appeals of shooting film is black and white photography. It’s the other side of the coin for color photos and somehow it tells a slightly different story. There are some really good fine grain films out there such as Kodak Tri-X 400, Ilford Delta 400 Professional, and Fujifilm Neopan 400 Professional. I’ve used Tri-X 400 before and the results were attractive.

The problem is, these films are not developed using the C-41 process. That’s the film development system/chemistry that most consumer color films use. It’s what is used to develop film at Costco via their big automated developer and printer.

To get those B&W films developed I have to use a lab in Manhattan and they’re not cheap. At Costco development with DVD but no prints costs about $5 a roll. At the lab it’s closer to $10 and the DVD has lower resolution images.

I shoot a lot of film. Costco wins.

That’s where films like Ilford XP2 Super 400 comes in. It’s a B&W film meant for C-41 so I can take it to get developed and scanned cheaply. I ordered 3 rolls from Amazon and here’s samples from the first roll.

I like the look. I can get better detail, resolution, and less noise (grain) from any of my digital cameras but shooting with my Olympus Trip 35 is a joy.

This weekend we’re celebrating Christmas at my brother Ed’s place so I plan to use at least one roll there. My sister-in-law keeps a beautiful house and there’s going to be lots of images for me to capture.

Fun with oEmbed and Twitter

This tweet is being displayed using oEmbed between WordPress and Twitter. This capability was added a few minutes ago after I pasted Otto’s code snippet into my theme’s functions.php file:

That’s pretty remarkable. I’ve embedded a tweet that has an embedded Youtube video in it. I didn’t even bother to wrap the URL in the [ embed] … [ /embed] shortcode, I just pasted in the link to that tweet.

That’s very cool! It shouldn’t be long before this is put into a plugin; I put it into my theme’s functions.php because I’m used to poking in there.

Interestingly enough, when the Twitter Blackbird Pie plugin is activated it overrides the oEmbed output and puts the tweet into that nice format that they use. For now I’ll use the oEmbed option.

Themify child theme fix

Update: Themify fixed the issue and an update is now available. The child theme fix is no longer needed.

I updated my Elemin theme to the latest and greatest and ran into a problem. They’ve changes how style sheets are queued up to use wp_enqueue_scripts.

That’s good, but now my child theme’s style.css will not get loaded, just the Elemin parent style.css file.

Easy to fix and I’ve added the following lines to my child theme’s functions.php file:

add_action( 'wp_print_styles', 'mh_remove_themify_styles' );
function mh_remove_themify_styles() {
        wp_dequeue_style( 'themify-styles' );
}
add_action( 'wp_enqueue_scripts' , 'mh_add_child_style' );
function mh_add_child_style() {
        wp_register_style( 'mh-child-style' , get_stylesheet_uri() );
        wp_enqueue_style( 'mh-child-style' );
}

That removes the parent theme style sheet and adds the child theme’s version.

Update: Themify (seriously, they’re really good and you should buy their themes) is going to address this problem with an update today. Which is good, de queuing their style sheet broke other styling and I ended up using add_action(‘wp_head’… instead of the above.

I really am limited by my PHP and CSS

As part of purchasing the Elemin theme I get support from Themify and I asked for CSS help on their forum. It’s a good benefit and part of the package.

I was able to get two full posts on the home page and leave the rest as excerpts but the CSS was baffling me. I couldn’t work out how to set the post-meta to format as I wanted it to.

My CSS is at best “not too good” and I was messing up some inherited properties.

The response was good: why not just wrap the posts in divs with the correct class and let the default style.css do the rest? That way the generated output would look kind of like this:

<div class="list-post">
 [post 1]
 [post 2]
</div>
<div class="grid2">
 [post 3]
 [post 4]
 [post 5]
 [post 6]
 [post 7]
 [post 8]
</div>

That was a real light bulb moment for me. I know I can do that by making a copy of the elemin/index.php file into my child theme directory and making modifications.

So that’s exactly what I did and replaced the regular get_template_part() line with this code:

<!-- child mods -->
<?php if( is_home() and $post_layout == "grid2" and $paged < 2 ) {
   $mh_post_count++;
   switch($mh_post_count) {
      case 1: ?>
         </div><!--/loops-wrapper list-post-->
         <div class="loops-wrapper">
         <div class="list-post">
         <?php get_template_part( 'includes/loop','index');
         break;
      case 3: ?>
         </div><!-- /list-post -->
         <div class="grid2">
         <?php get_template_part( 'includes/loop','index');
         break;
      case get_option('posts_per_page'):
         get_template_part( 'includes/loop','index'); ?>
         </div><!-- /grid2 -->
         <?php break;
      default:
         get_template_part( 'includes/loop','index');
   }
} else {
   get_template_part( 'includes/loop','index');
} ?>
<!-- /child mods -->

I also had to put in a conditional right before get_sidebar() to properly close off the last div. Changing the excerpt to the post content is still handled in the child theme functions.php file.

It all works and I’m now using it my child theme. This only gets applied when I select the two column excerpts page format. Switching to anything else restores the default Elemin formatting.

But you copied and edited a theme file!

Yes, I did and I’m thoroughly ashamed of myself.

There are hooks into different parts of the WordPress loop so that I should be able to put into my child theme’s functions.php file the logic to figure out where in the loop we are and insert the HTML as needed.

The logic is dependent on if we’re at post #1, post #3, and the last post defined by the posts_per_page option. So all I need to do is add the appropriate add_filter() or add_action() to my functions.php file. I already add to the_content using a filter for before and after.

But I’m not quite there yet. I’m pretty sure that I can pull it off with something like add_action( ‘the_post’, ‘insert_before_posts’ ) but I’m still doping it out.

I’m also having a great time doing it too which is really the point of all this effort. Now if only that WordPress Bible would get here sooner…

Christmas Tree Time!

Last year, the Sunday right after Thanksgiving I put up the Christmas tree with just the lights. I had intended to finish it after work but each week night I was too tired to do it. I get home after 7 PM and generally want to eat and relax. So the tree went a week without being completed.

Fortunately some friends came over the next weekend and with their help my family completed the tree. This year the same thing happened, except I planned it. The tree was put up this morning and after lunch my friends came over and helped my family again.

We all had a great time and Lily also put up some new decorations in front of the house. The kids made a mess in the basement but that happens when you have 6 kids running around. It’s now Christmas time and all is right in my world.

I can get used to this new tradition and I really enjoyed having our friends over with their kids.

Customizing the Elemin theme

NOTE: No parent theme files were harmed, modified, or otherwise abused in the making of this blog post.

Sometimes I do learn things! I was able to customize the layout of my blog using a child theme, some CSS, and some additions to my child theme’s functions.php file.

The Elemin theme from Themify is a great theme and I’m a satisfied customer. The only settings on my theme are on the Default Index Layout as follows:

  1. Display the sidebar on the right
  2. Display excerpts and not the full post content
  3. Post layout is in 2 columns
  4. Image size is 75×75 (for the featured image)

All the other settings are left to the default. Any customized CSS is handled in my child theme’s style.css file.

I like the layout of 2 columns of excerpts but also wanted to have 2 full content posts on top. My blog setting is to display 10 posts per page so that’s two posts on top and 8 excerpts afterwards in a 2 columns. Oh, and I want to maintain the scaling capability of the theme and do not want to modify copies of the parent theme files.

That turned out to be pretty straight forward. WordPress assigns a CSS class tag to each post with the post ID appended to it. So if this post ID was 4153, then a CSS class tag of post-4153 would be embedded in the generated HTML code. It’s done that way exactly so you can style individual posts like this.

For the latest 2 posts (for example ID 4153 and 4123), I want to generate CSS so that the width is now 100% and the featured picture, tagged with post-image class, is hidden. Also the second post I want to float left and adjust the left margin.

That CSS looks like this:

.post-4153 {
	 width: 100% !important;
}
.post-4153 .post-image a {
	 display: none !important;
}
.post-4123 {
	width: 100% !important;
	float: left !important;
	margin-left: 0 !important;
}
.post-4123 .post-image {
	 display: none;
}

To generate this output, I need to get the last 2 published post IDs, generate the CSS, and insert it into the header using this code in my child theme functions.php.

//
// Get the last two published post IDs.
//
$args = array(
'numberposts' => 2,
'post_status' => 'publish' );
$mh_post = wp_get_recent_posts( $args );
$mh_post_ID1 = $mh_post['0']['ID'];
$mh_post_ID2 = $mh_post['1']['ID'];
//
// Add my CSS to wp_head
//
add_action( 'wp_head' , 'mh_first_two_posts' );
//
// Create the code for the header
//
function mh_first_two_posts() {
global $mh_post_ID1, $mh_post_ID2;
if (is_home()) { ?>
<!-- child theme header -->
<style type='text/css'>
.post-<?php echo $mh_post_ID1; ?> {
width: 100% !important;
}
.post-<?php echo $mh_post_ID1; ?> .post-image {
display: none !important;
}
.post-<?php echo $mh_post_ID2; ?> {
width: 100% !important;
float: left !important;
margin-left: 0 !important;
}
.post-<?php echo $mh_post_ID2; ?> .post-image {
display: none;
}
</style>
<!-- /child theme header -->
<?php   }
}

That takes care of the CSS, but that only get’s me 2 full width excerpts. I want those 2 posts to output the whole content not an excerpt. The rest of the posts I want to remain in the excerpt format using two columns.

Easy to do because I can filter the excerpt and restrict my changes to just those two identified posts.

//
// Add my filter to the excerpt
//
add_filter( 'the_excerpt' , 'mh_excerpt_to_content' );
//
// Swap the excerpt for those two posts with the content.
// Don't forget to apply the filters to the content.
//
function mh_excerpt_to_content( $content ) {
global $mh_post_ID1, $mh_post_ID2;
$mh_id = get_the_ID();
if ( ( $mh_id == $mh_post_ID1 ) or ( $mh_id == $mh_post_ID2 ) ) {
$content = get_the_content();
$content = apply_filters( 'the_content' , $content );
}
return $content;
}

That works. The only disadvantage to this method is that the apply_filters get’s ran twice. If you have something that adds to the content, it will run once when the loop runs and again when I run it in functions.php. For me this isn’t a problem but I do want to see how I can clean that up.

The full content posts don’t look exactly like they do as a single post but I’m satisfied for now and I’ll keep playing with it for my amusement. Doing it this way really appeals to me because I’m able to maintain my blog’s changes and not worry about breaking something in the parent theme.

Time for a new WordPress theme

Old Hybrid child theme

The last time I switched this site to another theme was March 2010, before that April 2008. This time I’ve switched to a commercial them called Elemin. This is a first for me as I’ve never purchased a theme before. But it was on sale for Black Friday and I had been eying it since Automattic added it to their premium theme line up.

It was very easy to work with and the built-in option menus are simple to use. After installing it on my test blog I went to the control panel and made a couple of small setting adjustments. On my home page I want to show the full posts and hide the featured image.

After that I created a child theme and except for small CSS changes, a random header script, some PNG files for said headers, and some code in the child theme’s functions.php file I was all set.

Elemin on an iPad

I could have put the CSS into the theme settings under “Custom CSS” but I’m a huge fan of child themes.

You can examine my changes at the theme’s CSS file here. Rounded corners are a new thing for me; my CSS skills are non-existent.

Naturally the corners don’t work with Internet Explorer 8 and below, but hey, people should upgrade to IE 9.

One of the features I like about this theme is the ability to scale to the browser. When I move the window to become smaller, the columns shrink until the sidebar moves below the content. This causes my blog to be easy to read on an iPad.

Ideally all themes would be fluid and scale like this and it makes the viewing more attractive. I think the Twenty Eleven theme supports some scaling like that already but I’m not entirely sure.

Why a commercial theme?

Primarily for my curiosity. The Themify themes are GPL’ed and the distribution of this code is not restricted. I can make whatever changes I like as well as use the software as I see fit. The GPL is great that way and seeing how professional coders create themes enables me to learn even more.

I know that I could (probably, eventually, I’m sure I could…) get a free theme such as Twenty Ten or Twenty Eleven working like this, but I’m horrible at the styling. This theme is very flexible and the documentation is very good.

One thing Elemin is not is a theme framework. My blog was using a child theme of Hybrid and the theme author Patrick Daly knows his stuff. Patrick’s child theme WP Full Site was packed with PHP! Good stuff, but more than I could utilize. This current theme is more my speed.

(Was) Microsoft Touch Mouse

For years I’ve been using the Logitech MX Revolution mouse and it’s gotten long in the tooth. The pointer would stutter, the mouse buttons wouldn’t click, the click would release at the worst time, etc.

I could read the signs and it was time for it to go.

I was leaning towards getting the Performance Mouse MX but I figured I’d give Microsoft a shot and picked up the Touch Mouse. Naturally I got the “artistic” version. Both versions are expensive.

The Touch Mouse is supposed to be the Microsoft version of the Magic Mouse. The materials are nowhere near Apple standards but it’s a good plastic attempt. The ergonomics are acceptable and it’s comfortable to use. I prefer to be able to rest my hand on the mouse and it’s just the right size.

There is just one little drawback. It really only has one physical button so mouse button combinations are not doable. When you want to right mouse click you need to lift your finger off of the left side and there is no middle button. This is not really a problem and I’ve been using the Apple Magic Mouse like this for a long time. By installing AutoHotkey I’ve already started making macros for Apple like mouse-keyboard combinations.

I’m bringing this up for one reason. In FPS games, I frequently press and hold down the right mouse button to zoom into my target while pressing the left button to fire. This is a good strategy while hiding behind cover.

. . .

Okay, that will take some getting used to. I’ve already mapped the right mouse button to the left control in one game and with a little practice I’ll be back to normal. It’s a good thing I haven’t purchased MW3 yet.

Update the very next day: I returned the Microsoft Touch Mouse to Best Buy and picked up the Performance Mouse MX. It’s on sale and the price now matches the Touch Mouse. It was the buttons or lack of buttons that made me do it; this is not a mouse for anyone who plays games.

Now validated with StartSSL

So while I was putzing around with my SSL sites and getting some grief with mod_gnutls, I realized that my life really would be much easier with a valid wildcard SSL cert.

So naturally I went to StartSSL and went through the process for a Class 2 Validation. I had meant to do it for a long time and have been using their free Class 1 certificates for ages.

The process was easy and once I logged in, I uploaded some documentation and waited for the administrative work to complete. I used PayPal and shortly afterwards I received a phone call from Startcom. It was Eddy Nigg personally calling me to ask me the control questions.

I couldn’t help myself and I laughed out loud. I have been long admiring what he and his company have been doing with affordable SSL certs. I regard what other CAs charge as quite a successful scam and StartSSL’s efforts have been well on par with the other “Big names”.

So now I’m successfully validated, using a wildcard SSL cert for my entire domain, and I am officially a satisfied customer. I can’t recommend them enough.