When CSS Positioning Kills Functionality: Changing the Look of a WordPress Comments Form

When editing our theme, I had an interesting time editing the styling of the comments respond/reply form.

I was essentially modifying the WordPress TwentyEleven comments form, which looks like this:

WordPress TwentyEleven Comments Form

The form is huge though, especially since the blog posts we typically have are fairly short, I was afraid the comments form might end up bigger than the blog posts!

I figured the “quick” fix would be to simply lessen the amount of space between form fields. I did it the quick and dirty way, using:

#respond comment-form-field { margin-top: -30px }

Unfortunately, that broke the form fields. You could only activate the form field by clicking on particular areas of the field, which ended up being less than half of a field’s box.

It took me a while to figure out that the labels on each field would normally show above a field, but were repositioned on top of a form field. While this looks pretty, each label was taking up the equivalent space above a field; so if the whole field was repositioned to be closer to the above element, the space where the label would be overlaps the form field and thus block mouse behaviour. When a user tries to select the field, they’re actually selecting the paragraph element of the label:

Quick Fix Comments Form

In particular, this behaviour will happen any time an element overlaps another and its z-index is higher, literally positioned on top of the visible element below.

In the end, I restyled it with the labels above the fields so the gaps don’t look so big in between the fields. I also scaled it down somewhat, so that the end result is 243px shorter (in height) than the original and 123px shorter than even the ‘quick fix’ version. The end result:

Edited Comments Form

It still seems too large in comparison to a short post, so it will probably be restyled again later to be less wide as well and possibly scaled down even more. UPDATE: I wrote another blog post on further modifying the comments form, mostly using PHP.

Additional Information

For more on styling forms, check out WordPress’ article on Styling Theme Forms.

For those interested, here are the changes I made (classes that weren’t touched at all are not included):
[sourcecode language=”css” collapse=”true”]
#respond {
padding: 1.625em 0 1.625em 1.625em;
}
#respond input[type="text"],
#respond textarea {
(no change except removed text-indent)
}
#respond .comment-form-author,
#respond .comment-form-email,
#respond .comment-form-url,
#respond .comment-form-comment {
margin-top: -10px;
}
#respond .comment-form-author label,
#respond .comment-form-email label,
#respond .comment-form-url label,
#respond .comment-form-comment label {
-moz-border-radius: 3px;
border-radius: 3px;
left: -10px;
top: 4px;
padding: 3px 5px;
(mid-width removed)
}
#respond .comment-form-author .required,
#respond .comment-form-email .required {
font-size: 1.5em;
top: 33px;
}
/* added */
#respond .logged-in-as,
#respond .must-log-in,
#respond .comment-notes {
margin: 0.3em 0 1em;
 text-indent: 2em;
}
#respond .form-submit {
margin-top: -10px;
}
#respond input#submit {
font-size: 1.15em;
margin: 20px 0 0;
padding: 5px 15px;
left: 15px;
}
#reply-title {
font-size: 1.4em;
margin: 0;
(removed font-weight and line-height)
}
[/sourcecode]

How Hard Can Finding a WordPress Carousel Plugin Be?

UPDATE: I posted a newer analysis in June 2012.

A lot harder than I thought, I can tell you that.

Requirements & Options

I did have a few requirements:

  • work in a sidebar
  • have manual image selection (i.e. not only through featured image on posts)
  • be able to set an external link for each image
  • some sort of navigation i.e. arrows or buttons
  • works with other necessary plugins for our site
  • 2D, not a fancy 3D one (though in the future a 3D one might be nice for special collections & archives)

Preferred options include:

  • buttons or numbers to skip directly to a specific image
  • left/right arrow navigation on hover
  • caption text at the bottom of image
  • variety of choices for animation
  • shortcode to easily add into widget

Results

I tested a lot of plugins (at least a dozen), many of which didn’t work. My guess is that many are dependent on its own version of jQuery and other js files that conflicted with the built-in WordPress one or incompatible with the newest WordPress in some other way.

  • JJ NextGen JQuery Slider looked promising, but because NextGen messes with user permissions, it was conflicting with the user management plugin I had installed. I’m wondering now if I disable that part of the plugin whether it will work.
  • DOP Slider works but isn’t ideal since there’s no captioning and the arrows weren’t showing up for me.
  • WP jQuery Text and Image Slider works but is also not ideal since it has no captioning and would need styling done so it doesn’t put it into a frame.
  • Nivo Slider for WordPress worked great. It would need a shortcode added (but that’s easy enough) and the buttons aren’t showing, which is obviously a bug, but we could probably fix it if we wanted them.

Many of the plugins are based on the jQuery Nivo Slider, which is free. Why not just use that? Well, we want our users to be able to add images themselves, and not rely on our team. The Nivo Slider developers offer a WordPress version, but it’s paid. It’s a fairly small amount though so I might recommend purchasing it instead of having to customize existing plugins, especially if it’s a one-time payment.

Find & Fix Missing Category in WordPress (.com)

Seems like after the upgrade, a number of people have had the problem with randomly missing categories from the admin panel/dashboard. One of mine randomly disappeared after I renamed it. It was no longer a subcategory and was at the bottom of the list (not alphabetical order) on all the filters etc., but refused to show up in the Categories admin panel.

So, I found lots of information on how to fix missing categories for wordpress, but not when you use wordpress.com. After much searching, I found one solution on wordpress.com forums (second last reply), but what’s missing is the key element on how to figure out your category ID. Easiest way then:

Find your category ID by looking at the source code for your blog. You will see for example, <li class=”cat-item cat-item-78954″>. The number is your category ID. Similar thing for tags.

You must have categories (or tags) displayed on your blog for this to work obviously.

WordPress annoyances

Warning: This is more of a rant than productive thought

maybe I’m just inexperienced, it probably doesn’t help that I don’t have admin access, but even asking coworkers whether something is possible seems to give me a “no”. Mind you, it’s not wordpress.org, but wordpress MU where my access is more or less restricted to the kinds of things I would be able to do on wordpress.com.

I haven’t figured out how or can’t do the following:

  • redirect pages (short of hardcoding it into the server)
  • make the frontpage not look for blog posts (and if there are none, not to display an error)
  • display subpages on a page (not in a navbar) short of manually doing it
  • change the width of a column (I know, I know, this is coded into the theme)
  • know exactly what it’s doing with my HTML code…. I’m stuck right now because I’m having a problem where the HTML code looks just fine but there’s something going wrong (thankfully a coworker is looking into that)

I’m sure I will be more and less frustrated with WP as I learn more about it.