- That can’t happen.
- That doesn’t happen on my machine.
- That shouldn’t happen.
- Why does that happen?
- Oh, I see.
- How did that ever work?
I love WordPress. It’s an amazingly powerful open-source CMS and it’s been my go-to for years. The one drawback I keep running into is how best to utilize its media library.
I have tons of photos and would love to organize them, but most plugins seem to have more than I need. I would rather improve my media library rather than install something that saves photos in a completely separate area.
Hi there. I absolutely adore this plugin called Media Library Assistant. It makes organizing photos so much easier than I ever thought possible. A big thank-you to David Lingren for creating such a genius piece of code!
Having said that, I wanted to assist in an issue I’ve tried to tackle quite a few times:
Convert the Upload Date to match the Photo’s Creation Date
Tonight, with the help of this plugin, I was successful! Please note, anyone who tries this, it is not for the faint of heart, as it required me to go into my database via PHPMyAdmin and make changes with a SQL statement (a harmless statement, but you have been warned). I highly recommend backing up your database just in case before trying this. 🙂
OK, here goes. I’ve wanted the upload date to match the photo date ever since I uploaded my first photo to WordPress when it was already past the date it was taken (which is forever). With the help of MLA, I was able to map the creation date, then update the upload date to match the newly saved creation date. Here’s how I did it:
Under Settings > Media Library Assistant, I went to the IPTC/EXIF tab and created a new mapping. These settings belong under Add a new Field and Mapping Rule:
I then clicked “Add Rule” and then “Map All Attachments, Custom Fields Now” button, and my dates were entered! Below is what my settings look like for this item:
Next, I had the problem of getting that date into the upload date field. Here’s where the tricky stuff starts to happen.
The post information is inside the “wp_posts” table, while the data for each post is inside the “wp_postmeta” table. So, the date is saved in one and displayed from the other. Here’s the SQL statement I wrote:
UPDATE `wp_posts`, `wp_postmeta` SET `wp_posts`.`post_date` = DATE_FORMAT(STR_TO_DATE(`wp_postmeta`.`meta_value`, "%Y:%m:%d %H:%i:%s"), "%Y:%m:%d %H:%i:%s"), `wp_posts`.`post_date_gmt` = CONVERT_TZ(DATE_FORMAT(STR_TO_DATE(`wp_postmeta`.`meta_value`, "%Y:%m:%d %H:%i:%s"), "%Y:%m:%d %H:%i:%s"),'+00:00','+04:00') WHERE `wp_posts`.`ID` = `wp_postmeta`.`post_id` AND `wp_posts`.`post_type` = 'attachment' AND `wp_postmeta`.`meta_key` = 'Date Taken';
Now, there is a lot going on here. First, we’re telling the database to find the new Field Title (that’s the “meta_key” in the wp_postmeta table), take that date, and then update “post_date” in the wp_posts table to match. We’re also telling it to convert the format from
YY:MM:DD hh:mm:ss to
YY-MM-DD hh:mm:ss so that WordPress can have the correct date format. Then, since I’m in the EST time zone, change the “post_date_gmt” field to add four hours (see the
+04:00 bit). Lastly I tell it to only do this with items that are attachments (this keeps it from accidentally updating a post). It worked wonderfully!
My goal is to try and get as much of this into MLA as possible. That way, I don’t have to keep updating the tables manually.
My only wish now is that I could do something similar to what Media Library Plus has available, which is allowing someone to upload images into any directory within wp_content/uploads. I ask for this, because I’d like my images from September 2015 to show up in the 2015/09 directory without me having to do it manually. If only there were a bit of code for that as well…. Maybe I’ll have a part 2 covering that bit 🙂
If you have a WordPress install, check that you keep your plugins, themes, and version up-to-date. This post will describe how to check the status of these items and how to update them.
When you log in to the admin area of your site (http://yoursitelink/wp-admin), you might see one of these:
You can also check the admin menu bar for additional updates (the number indicates total updates, including plugins, themes, and version):
Go ahead and click “Please update now”, or you can click on the number in your menu bar.
I recommend updating items in this order:
After updating the WordPress version, you may see more numbers pop up. This indicates that a plugin or theme you have installed has an additional update to bring it into compatibility with the new WordPress version you now have.
For the WordPress version, you will see this window:
Click “Update Now”. You should then see this window:
Wait a moment, and the screen will refresh on its own. If it does not, click the “here” at the bottom of your screen. You should now see this (or something close:)
The next section will only apply if you have more than one site within one WordPress install).
If you have a WordPress Multi-Site install, you may be asked to upgrade your network. This process brings all your sites into compatibility with the new WordPress version. Go ahead and click the “Upgrade Network” link on the next page:
WordPress will automatically cycle through all your sites. If it cannot, you will be given a “next” button to click at the bottom of each page.
Once you have completed the Network upgrade, you are done!
Be sure to check on your WordPress install at least once a month. WordPress updates are almost always security updates, so keeping your install, plugins, and themes current will improve the security of your site.
Setting up your own WordPress installation can be fun and easy, and you can even set it up on your own home computer! When doing so, there are sometimes some very strange errors or screens you’ll start to see that you didn’t see before… for instance, you’ll be asked for FTP information when uploading a plugin or theme, or when you update your version of WordPress. You also may experience strange URL errors or problems browsing to certain areas. Included in this post is information and general suggestions on setting up your own web hosting on your OS X machine. Continue reading “Web Hosting on OS X”
Open up the Sharing panel in System Preferences, and you’ll see that Web Sharing is no longer listed here.
Luckily, this is only a visual (GUI) change. You can still turn on web sharing by sending commands to Apache. The quickest fix I found is to use Terminal to send commands:
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
If you run into any problems, feel free to comment on this and I’ll reply with solutions as I can find them.
Here is a snippet of code to add to your site that will allow anyone who is a member of your site to receive an email notification whenever a new post is added. This is not a plugin; you really don’t need a plugin to turn this feature on. Continue reading “New Post Notification”
I saw a nice “download” button today, and thought I’d see if I could re-create it in CSS. Here’s the graphic:
Next, I decided to try breaking it down into elements. There is a dark border around the item, a green gradient background, white text and a green shadow around the text. I have a few tricks for completing this:
Click the link below to download the complete HTML page, including all CSS used and a copy of the graphic used above.