HOWTO: Easily Disable Comments on Posts in WordPress

After a recent WordPress blog import – I needed to make sure comments were not allowed on any previous or future posts. You can easily disable any future posts from having comments by changing the setting in “Settings > Discussion > “Allow people to post comments on new articles” (see screenshot) – but you can override that setting on a post by post basis when editing older posts.

Now the I had all comments set to off for future posts – it was time to address the older/existing posts which all had “Allow comments” set to yes. In order to quickly change all existing posts I used the “Bulk Actions” option when listing all posts. From there I selected “Edit” and then made sure all of the posts were highlighted (50 at a time).

That then brought up the option to set Comments to “Do not allow” for the selected posts. After going through this process a few times – all my posts now had comments turned off and I was done.

You could also update all your posts with a database query – but this way allows you to quickly and easily take care of changing your comment status, post format type, author, status, categories, and tags.

Lesson learned: do not underestimate the power of the “Bulk Actions” for making quick/easy changes to your posts.

WordPress 4.9.6 Privacy and Maintenance Release Available

WordPress 4.9.6 is a privacy and maintenance release in order to help with the European Union’s General Data Protection Regulation(GDPR)

Things to note

  • Privacy Policy – Create/specify a privacy policy page now in Admin > Settings > Privacy. Once you designate a page as your privacy policy page – it will show up as a link on your user registration and login pages.
  • Right to Remove – WordPress now has the ability for site owners to export all user data as well as erase user data per GDPR.

You can read more by looking at the release notes: https://codex.wordpress.org/Version_4.9.6

If you have not done so already – download the update or simply use your existing installation of WordPress to update your site. Either way – this is an excellent time to make a backup copy of your site(s) before upgrading.

HOWTO: Simple Bootstrap 4 WordPress Gallery

If you are looking for a simple way to have your WordPress inserted galleries use the Bootstrap 4 layout – look no further. Just drop this code into your theme’s functions.php file and any WordPress gallery you insert when selecting media ([ gallery ids=”” ]) will then use the Bootstrap layout.

Code Needed for the WordPress Gallery

/**
 * Bootstrap 4 gallery
 */
add_filter( 'post_gallery', 'lucidity_bootstrap_gallery', 10, 2);
function lucidity_bootstrap_gallery( $output = '', $atts, $instance ) {
    if (strlen($atts['columns']) < 1) $columns = 3;
    else $columns = $atts['columns'];
    $images = explode(',', $atts['ids']);
    
    // Set the # of columns you would like
    if ( $columns < 1 || $columns > 12 ) $columns == 3;
    
    $col_class = 'col-lg-' . 12/$columns;
    
    $output = '<div class="row text-center text-lg-left gallery">';
    $i = 0;
    
    foreach ( $images as $key => $value ) {
       
        $image_attributes = wp_get_attachment_image_src( $value, 'thumbnail');
        $output .= '
            <div class="'.$col_class.'">
              <a data-gallery="gallery" href="'.esc_url($image_attributes[0]).'" class="d-block mb-4 h-100">
                    <img src="'.esc_url($image_attributes[0]).'" alt="" class="img-fluid img-thumbnail">
                </a>
            </div>';
        $i++;
    }
    
    $output .= '</div>';
    
    return $output;
} 

A few things to note:

  1. This example uses the image size “thumbnail”. If you want to use something different – you can change that here on this line: $image_attributes = wp_get_attachment_image_src( $value, ‘thumbnail’);
  2. This example uses 3 columns. Depending on the size of your images – you may also what to change that. You can make the change by changing the two references to “3” in the code above ($columns == 3, $columns = 3)

You can see the gallery in action here: http://www.jappler.com/2014/07/25/recent-visit-911-memorial/

WordPress 4.9.5 Security and Maintenance Release Available

WordPress 4.9.5 is a security release for all previous versions since WordPress 3.7

Things to note

It is highly recommended you update your sites immediately in order to apply important security and the additional 25 bug fixes. You can read more by looking at the release notes: https://codex.wordpress.org/Version_4.9.5

If you have not done so already – download the update or simply use your existing installation of WordPress to update your site. Either way – this is an excellent time to make a backup copy of your site(s) before upgrading.

Google Font Pairing Made Easy

Looking to update your site’s font but not really sure what would look good? If you find a Google Font as a base font – Google offers pairing suggestions and then shows how they look with each other. This makes it easy to then pick a title font, body font, etc by seeing how they look together before you commit to one font or another.

Example:

Let’s say you really like the Google font Oswald as your title font, you can then adjust the fonts under the “Popular Pairings with Oswald” to see their suggested pairings in all their font weight possibilities. Overall – this is a huge help for both designers and design challenged people who are looking to make some typography changes quickly and easily. Thanks Google!

Structured Data with Bootstrap

Perhaps you used Bootstrap for your web site and are excited that you have a responsive web site with all the bells an whistles. You were hoping that would help your SEO ranking, but you should know there is more to be done! Enter “structured data“. Structured data can help differentiate a recipe from an article from an event – all things that Google supports and will display depending on how the structured data is set up.

Not sure where to start?

Navigation

The differences are not too much but can make a big difference.

Simple Default Bootstrap Navigation
<ul class="navbar-nav mr-auto">
<li class="nav-item active"><a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a></li>
<li class="nav-item"><a class="nav-link" href="#">Link</a></li>
</ul>
Simple Default Bootstrap Navigation with Structured Data
<ul itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement"class="navbar-nav mr-auto">
<li itemprop="name" class="nav-item active"><a itemprop="url" class="nav-link" href="#">Home <span class="sr-only">(current)</span></a></li>
<li itemprop="name" class="nav-item"><a itemprop="url" class="nav-link" href="#">Link</a></li>
</ul>

Breadcrumbs

By adding a little code to your already existing breadcrumbs – you will provide structured data that search engines can understand.

Simple Default Bootstrap Breadcrumbs
<ol class="breadcrumb">
<li class="breadcrumb-item"><a itemprop="item" href="/"><span itemprop="name">Home</span></a></li>
</ol>
Simple Default Bootstrap Breadcrumbs with Structured Data
<ol itemscope itemtype="http://schema.org/BreadcrumbList" class="breadcrumb ">
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="/"><span itemprop="name">Home</span></a></li>
</ol>

Once you add in structured data to your site you can then use the Google Structured Data Testing Tool to make sure everything is set up and configured correctly. Not sold? Check out: The Beginner’s Guide to Structured Data for SEO: A Two-Part Series

Note: This is based on Bootstrap 4.

Fix: Nothing Showing For Popular Posts Widget

I recently ran into an issue with the WordPress Popular Posts plugin where it showed the bullet points for the number of popular posts I wanted to show – but no content.

Empty Popular Posts

Debugging the issue

  • I made sure I had JetPack installed
  • I had plenty of stats – but could not get any data to show. Stats were showing as expected with the JetPack plugin stats view
  • I deactivated/re-activated the WordPress Popular Posts plugin.
  • I turned off caching
  • I tried a number of different configuration options in the widget

I still was not seeing any content though. This then made me think I needed to try something different with the way the list item was formatted. At this point I then noticed that format field was blank. Since I could not remember if that was the default – I looked at the plugin readme file and added in the default (see below).

Default format setting that needed to be re-input
<a href='%post_permalink%' title='%post_title%' >%post_title%</a>

After that was in place and the widget settings were saved – the popular posts once again saved. If you notice something similar – and you are having issues getting content to show AND you know it is not a statistics issue – they the same configuration change I mentioned above. I hope it helps!

WordPress 4.9.4 Maintenance Release Available

WordPress 4.9.4 contains a fix for a severe bug which stops automated updates.

Things to note

WordPress 4.9.4 should be appplied to your site(s) in order to address a bug introduced in WordPress 4.9.3 which makes any site that uses automated updates stop updating. You will need to manually update WordPress in order for the automated updates to continue. You can read more by looking at the release notes: https://codex.wordpress.org/Version_4.9.4

If you have not done so already – download the update or simply use your existing installation of WordPress to update your site. Either way – this is an excellent time to make a backup copy of your site(s) before upgrading.

WordPress 4.9.3 Maintenance Release Available

WordPress 4.9.3 contains 34 bug fixes.

Things to note

WordPress 4.9.3 should be appplied to your site(s) in order to address the bugs fixed in the Customizer, widgets, visual editor, and PHP 7.2 compatibility. You can read more by looking at the release notes: https://codex.wordpress.org/Version_4.9.3

If you have not done so already – download the update or simply use your existing installation of WordPress to update your site. Either way – this is an excellent time to make a backup copy of your site(s) before upgrading.

WordPress 4.9.2 Security and Maintenance Release Available

WordPress 4.9.2 is a security release for all previous versions since WordPress 3.7

Things to note

It is highly recommended you update your sites immediately in order to apply important security and the additional 21 bug fixes. You can read more by looking at the release notes: https://codex.wordpress.org/Version_4.9.2

If you have not done so already – download the update or simply use your existing installation of WordPress to update your site. Either way – this is an excellent time to make a backup copy of your site(s) before upgrading.