Add Bootstrap Button Classes to the WordPress Comment Form

Looking to stylize that WordPress comment button on the WordPress comment form? Adding the correct classes needed to the comment form button are as easy as finding where comment_form() is called in your theme. In my cases – this is within the comments.php file.

Once you find that – you just need to change
comment_form()
to:

$args = array(
'class_submit' => 'btn btn-default',
);
comment_form($args )

There are a number of modifications you can make to the comment form (changing button text, changing labels, adding notes, etc that you can make with the comment_form() function which are worth looking at here: https://codex.wordpress.org/Function_Reference/comment_form

Add Bootstrap Classes to WordPress Widgets

When creating your Bootstrap WordPress themes, you will notice the sidebar widgets (archives, categories, etc) which use dropdowns do not share the Bootstrap styling because there is no place easily accessible to add in the needed classes or CSS.

Considering the options – here are two ways you can turn those default selects into something that matches the rest of your beautiful Bootstrap site.

Add a filter in your functions.php file

This is specific to the category dropdown. I was hoping we could use the same on the widget_categories_dropdown_args filter, but that is not possible as of WordPress 4.6. (see next example to address this). This filter works great if you use the categories widget and no other that display a select.

/**
 * Add CSS class to sidebar category selects.
 */
add_filter( 'widget_categories_dropdown_args', 'lucidity_widget_categories_dropdown_args' );
function lucidity_widget_categories_dropdown_args( $args ) {
    if ( array_key_exists( 'class', $args ) ) {
        $args['class'] .= ' form-control';
    } else {
        $args['class'] = 'form-control';
    }
    return $args;
}

Add some Bootstrap CSS to your style.css file

This works great if you have multiple selects displayed within your widgets. Note: the sidebar in the example has an ID of “sidebar”. This CSS is brought over from the Bootstrap .form-control style.

#sidebar .widget select {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

I hope this helps make your site a bit more cohesive with the Bootstrap styles!

Remembering My Mentor: Alex King

I was very sad to hear that Alex King died a few days ago and have been trying to think about what to say. If you do not know Alex or who he is – he was many things to many people – but to me – he was my mentor. I was an early adopter of WordPress (back before themes and plugins). I started following him (RSS) back in 2002 because he was always creating/sharing snippets and eventually themes/plugins that made WordPress better. I also was one of the first users of his Tasks software which I used religiously – so much so that I would email him with questions/suggestions, and would partake in beta testing new versions. He was also an avid golfer who enjoyed his PING irons like me.

After one email in which I mentioned I wanted to start my own company – much like he did, he offered his support, advice, and even started sending me referrals. I am sure I would not be where I am today without him. He was meticulous with his code and kind with his words. He was always very approachable and always made time for me. He consistently put a lot of thought into his work – so much so that he one time asked for my feedback on possible change options for his email signature. He made sure things were not just done, but done right. He provided guidance to me on many levels – everything from code reviews to business advice.

To me – Alex King will always be the one person in my life that pushed me to get out of my comfort zone, put myself out there, and to do great things. He also taught me that not all ideas/projects will be a success – but to keep trying and never give up. While I am very sad Alex King is no longer on this earth – I am so happy to have made the connection with him 13+ years ago. I will be forever grateful for everything he has done for me and other developers like me. Thank you Alex – for your code, your time, and your inspiration.

How To Not Get Me to Update One of My Free WordPress Plugins

This morning I arrived in my office to see an email with a request to make a change to one of my free WordPress plugins: SDAC Translate. I take requests and have made changes to pretty much all the plugins I have available as long as they are reasonable and would help/benefit other users as well.

The person who emailed me started off by calling me a “bigot” because I used the US flag for English and the Portuguese flag for Portuguese (instead of also offering the UK and Brazilian flag as options). They then told me I should take all the money I earned from people donating (over 2,500 downloads, no donations) to go fly to the countries so I could see the difference between the US/UK and Brazil/Portugal. They then also told me they were disabling the plugin until I made the change – and were going to tell everyone why they disabled it.

While I thought about it for awhile – I realized this could get ugly fast. I would potentially then have to have a Canadian flag for both french and english, Mexican/Peru, etc for Spanish, etc It is just not something that I thought would be a good thing for the plugin. The flags are there for a general representation of languages. Google Translate does not care if it is US vs UK – you still get the same exact EN translation.

While name calling and threats apparently work- for putting in extra development (free) time for a plugin which is also free – I decided that I would keep the integrity of my plugin as is and not make any changes. I then mentioned how they could easily take what I had under the GPL license and make their own changes to it – without any issues.

Something to remember – when making any requests for free development on a free product – at the very least, be kind or do it yourself.

WordPress Themes Over the Years…A Look Back and Then into the Future

After working with WordPress for over five years now, I have seen a lot of changes both front-end and backend – both for developers and for users. I work for the most part on WordPress themes for a few hours a day and have been doing so for the last 3+ years full time. As I wrap up the final changes for my company’s commercial WordPress theme Lucidity – I wanted to take a few minutes and point out some of the changes over the years and also talk about where I think themes are going.

I remember back in the day being excited about Alex King’s Theme Competition and wishing I had some spare time (I was working full time and doing consulting every other moment) to also participate. These early themes were generally simple and were something people would use on their simple blogs -using a hand full of WordPress functions. During this time, the functions.php was unheard of and there were not too many custom functions that were used (for most themes). The big difference between them were mostly in how the sites were laid out with HTML and CSS. Even though these themes were simple – they were great because it allowed you to easily modify the look and feel of your site by editing a few template files and modifying the CSS.

These themes were more about look and less about function.

If you think about themes then and themes now – the difference is often huge. Most themes now are packed with custom functions, have advanced admin options, and give the users greater control of their content, the site’s look and feel, and general options – all without having to modify any template files or know any CSS. Themes are more complex, are generally made up of more template files, and are much more flexible.

These themes are more about providing both users and other developers with a framework and tools to easily manage content.

Recently Alex King/Crowd Favorite released Carrington Build which is a perfect example of where themes are going. This theme offers an unbelievable amount of flexibility and customization and will make both users and developers eager to use this theme.

So as I wrap up development on Lucidity – I am trying to bridge the old (simple) with the new (framework/tools). I look forward to getting this out to the public so they can enjoy the ease of use, flexibility, and further control over their content.

All in all – WordPress themes have come a long way and will not only continue to improve user’s front end experience, but also improve the backend experience when using WordPress. Look for even greater things to come!

Which WordPress Caching Plugin Is Right For You?

Most people can agree on one thing: they want their site to load faster. With a number of WordPress caching plugins now available – it is nice to see someone that did a comparison between the top contenders: http://www.tutorial9.net/web-tutorials/wordpress-caching-whats-the-best-caching-plugin/.

Remember – your results will vary based on your hosting environment, your theme, your plugins, etc.

WordPress 3.0 (beta1)

I have been testing WordPRess 3.0 for a few weeks now and have been very happy with what I have seen so far. The merge of Standalone WordPress and WPMU code is huge for me as you then only have one code base to maintain and develop for.

As always – the developers continue to make WordPress easier and more robust with every release. There are some great new features which make WordPress more and more appealing to both small and large companies looking for an easy to use and maintain CMS.

With WordPress 3.0 – there are now “custom post types” which will allow people to better define their content. Example – you are a company that has a portfolio. Instead of using the traditional pages or posts for that, you can create your own “post type” of portfolio which would then keep it completely separate from the blog posts and site pages organizationally. The possibilities are endless.

Creating and maintaing your menus will be easier than ever too. No more custom menu ordering with numbers – you can now drag and drop menu items into place.

There are a number of other changes too which include a new default theme, improved child theme support, some nice new UI touches, improved revision comparison user interface, new template files for better control, and countless other goodies which I am sure I will cover in the coming weeks.

All in all – this is an exciting update which promises to deliver both to users and developers alike!

WordPress 2.9 – An Amazing Update

I have been working with WordPress 2.9 now for a few weeks and I cannot remember the last time I was so excited with the new features of WordPress. There are countless little improvements most users would not notice, but there are some killer new features that should not be overlooked.

  • First and foremost – working with images just got a lot cooler!
    • Thumbnails Finally after creating several custom plugins for this – there is now a simple way to select and then use a thumbnail for each post. Simply add a few lines of code into your theme’s functions.php file and you are ready to go.
      add_theme_support( 'post-thumbnails' );
      set_post_thumbnail_size( 150, 150, true ); // Normal post thumbnails

      (more details)

    • Cropping Ever need to crop a photo for your post or page? You can now upload any image, use built in crop functions to select the part of the image you want, save the cropped photo, and then use it – all within WordPress. Say goodbye to opening up Photoshop, cropping, saving, uploading, etc. Say hello to an easy to use streamlined process.
  • We’ve got trash! No more “crap I just deleted that post”. Now you have the option to Edit, View, or Trash a post or several posts. Once the items are in the trash you can easily recover them or permanently delete them.
  • Repair those tables please.Now you can automatically optimization your database by adding this line to your wp-config.php file: define(‘WP_ALLOW_REPAIR’, true);

Some screenshots of interest

Use As Thumbnail

Crop, Scale, etc

If you have not updated to this version – please take some time and take a look. The cropping alone will save hours of time if you ever needed to manipulate your images! Overall, this update took things one step further to making a solid, feature rich content management system and I am excited to use some of these new features with each new site I create!

WordPress 2.9 RC 1

Well – it is that time again – another new version of WordPress is coming out in the next few days (WordPress 2.9). I am running WordPress 2.9 RC 1 here on jappler.com and only one issue so far. If you have not read anything about the newest version soon to be available and you use WordPress, check out: WordPress 2.9 New Features/Changes.

WordPress Wednesdays: Little WordPress Gems

Every once and awhile while looking through the WordPress documentation, I find little gems. Here are a few that I found particularly interesting:

  • wp_page_menu Easily create a menu with the home page appended onto the menu with a lot of parameters. Similar to the standard wp_list_pages, but with some different possibilities
  • the_search_query I have seen several ways to get this, but this is by far the easiest, quickest, and most secure.
  • wp_reset_query If you use conditional tags, you will end up going crazy at some point and then will realize this is needed. Note to self everyone.