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.

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.

WordPress 4.9.1 Security and Maintenance Release Available

WordPress 4.9.1 is a security and maintenance release for all previous versions.

There are four security issues addressed in this update as well as eleven bugs that were fixed. Please make sure you update your sites if you do not have auto updates enabled.

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

Coding enhancements, Customizer enhancements, more widget updates, and site building improvements.

Things to note

There are a lot of great improvements packed in WordPress 4.9, including one of my favorites – error checking when working directly with files through the WP Admin. One of the scariest things in WordPress is editing plugins/themes directly through the admin interface the next scariest thing is making a change, getting the white screen (an error) and then not being able to access the site. Fortunately for the people that make these changes via the editor – there is now error checking in place so that any errors are caught/identified before the save – saving all of us white screens, and stress.

There are also a number of enhancements to the Customizer so making your site exactly how you want it is easier than ever. You can even save “drafts” of design changes, preview them, share the preview links, and collaborate before you release changes and go live. Speaking of going live – as of WordPress 4.9 you can schedule your new design to go live at a specific time/date if you choose.

All in all – there are a lot of great changes in WordPress 4.9. You can read more by looking at the release notes: https://codex.wordpress.org/Version_4.9

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.