Category Archives: Website Update

How To Exclude Categories in WordPress Archives Drop-down

This is a follow-up post to my Excluding Categories from Different Parts of WordPress post a while back. The problem I was having is that the posts in my Testing and Daily Tweets categories where being counted and shown in the Archives drop-down widget. For example, it showed 4 posts in April 2011. When selecting April 2011 in the drop-down, you would get the “404 Not Found” page since all 4 posts belonged in the Daily Tweets category which is excluded from showing in the main blog, except when being accessed via the Category drop-down.

After some searching, I found the following thread: wp_get_archives and Conditional Tags and adapted the code as follows in my theme’s functions.php file:

add_filter( 'getarchives_where', 'customarchives_where' );
add_filter( 'getarchives_join', 'customarchives_join' );

function customarchives_join( $x ) {

   global $wpdb;

   return $x . " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";

}

function customarchives_where( $x ) {

   global $wpdb;

   // 61 = Daily Tweets, 74 = Testing
   $exclude = '61,74'; // category id to exclude

   return $x . " AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id NOT IN ($exclude)";

}

Now, it does not count those posts in the Archives drop-down. Yay! 🙂

Blog Updated to WordPress v4.2

A couple days after WordPress 4.1.2 came out, WordPress 4.2 did. I have thus upgraded my blog to it. They also updated most of the default themes including the one I use, TwentyTwelve. I did a file comparison and noticed that the header.php file was the only one I needed to update for my child theme.As always, I did a complete database and file structure back-up before doing anything.

One thing I’ve noticed while making this post is the highlighted text is automatically placed into the “Link text” field of the Insert/edit Link button. Anyway, I’ll let you read the WordPress 4.2 stuff for all the changes and fixes. 🙂 

Website Changes for April 2015

Main Website

I updated my NASCAR page to get its news feed from Yahoo instead of ESPN after it started to bug out. I also added a new speed test to my Latest Speed Test Results page. It’s DSLReports‘ new Speed Test which is still a work in progress.

Finally, I’ve started to test out using HTML5 with Flash fallback video players on my site. I am using my Inception Blu-ray page for these tests. Currently I am testing out Mediaelement.js player. I have also tried out the JW Player and Video JS players. I suppose I should make one test page for each player to see which works best.  I’d use the JWPlayer if it didn’t have the logo always on the player (the free one anyway). I’m still playing with them to see which I like better.

Blog

The main thing with my blog is that I have disabled the Really Simple Share plugin because of what they’ve started doing with it and am now using the Jetpack Sharedaddy module to place Twitter, Facebook, and Google+ buttons on my posts. Using it for now anyway.


That’s all for now. If I think of anything else I’ll update this post. 🙂

Website Changes for March 2015

All Sites

After running various website speed tests (Pingdom, Google PageSpeed), it told me that I should enable compression (gzip) and take advantage of the browser’s cache. So, I started to do some research on how to turn those on at my webhost. For compression, I finally noticed an “Optimize Website” option in cPanel after I had tried some things in .htaccess that were not working. There I was able to enable it for the following mime types: text/html text/plain text/xml text/css application/javascript. The results were rather dramatic. A 40K html file would be compressed down to 10K or something.

For the caching part, I found the following piece of code to be placed into the .htaccess file in my highest level directory:

<IfModule mod_expires.c>
          <FilesMatch "\.(jpe?g|png|gif|js|css)$">
                      ExpiresActive On
                      ExpiresDefault "access plus 1 month"
          </FilesMatch>
</IfModule>

And, hey it worked! Files of those types are now set to expire after 1 month. Before, Firefox was caching things based on how recently the file was modified. I found an explanation here: Two Important Differences between Firefox and IE Caching. After making these changes, the response headers coming from the server were now like:

Cache-Control: max-age=2592000
Connection: close
Date: Wed, 11 Mar 2015 23:02:20 GMT
Etag: "1410-419260a0e3ec0"
Expires: Fri, 10 Apr 2015 23:02:20 GMT
Server: Apache

These changes affected the behavior of all my websites. I was also advised to make the connection keep-alive but I think my webhost has that disabled for performance reasons.

Main Website

I modified most of the main pages to show a last modified date in the central time zone. A lot of pages still show an eastern timezone (DVD pages mainly). It’s a difference between the date being generated via SSI (server side include) and PHP which has been configured for the central timezone even though the server itself is in the eastern timezone.

Blog

My Blog was updated to WordPress v4.1.1. Backed-up the database and file structure and clicked the update button. Not that big a deal. I also figured out how to add a function that would tell me how much memory PHP was using in the Admin section without changing any of the core files:

###########################################################################################
function memory_stats()
{ // BEGIN function memory_stats
   if ($_SERVER['REMOTE_ADDR'] == HOME_IP) {
      echo '<p style="clear: both;">Memory used: '. number_format(memory_get_usage(true)). ' bytes.<br />';
      echo 'Peak Memory used: '. number_format(memory_get_peak_usage(true)).' bytes.</p>';
   }

} // END function memory_stats

add_action('in_admin_footer', 'memory_stats');

On average the admin portion uses around 40MB. I have PHP configured to 128M. I then noticed some CSS problems after one of my plugins updated and corrected that.

Gallery

I updated my galleries to Zenphoto 1.4.7. Actually, I’m using one of the master support builds due to some bugs I discovered that were corrected in the support version. I’m not going to go into detail about what all I did. Not in the mood right now and I doubt anybody cares LOL. Actually, it could be its own post if I wanted it to be.


Well, that’s all I have for now. 🙂 If I think of anything else I’ll update this post or make another.