Solution to WordPress 2.7.1 Gallery Code Problem

I tried to find a solution to the WordPress 2.7.1 gallery code problem. I checked some templates first but I was not able to identify the right one. So I searched the web and I found the solution from this blog entry, Problem with WordPress 2.7.1 and images.

I was looking into several templates like link-template.php and post-template.php but did not think about the post.php file. With his solution, I was able to solve my problem that I told you in my previous blog entry.

This was the PHP function wp_get_attachment_url at WordPress 2.7.

function wp_get_attachment_url( $post_id = 0 ) {
	$post_id = (int) $post_id;
	if ( !$post =& get_post( $post_id ) )
		return false;

	$url = '';
	if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true) ) { //Get attached file
		if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { //Get upload directory
			if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location
				$url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location
		}
	}

	if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this.
		$url = get_the_guid( $post->ID );

	if ( 'attachment' != $post->post_type || empty($url) )
		return false;

	return apply_filters( 'wp_get_attachment_url', $url, $post->ID );
}

If you read the blog entry where I found the solution, you will see there the present PHP function wp_get_attachment_url at WordPress 2.7.1.

I just commented (using // before each line) the following four lines which was added or included or inserted at the PHP function wp_get_attachment_url at the post.php when WordPress 2.7.1 was released. You will find post.php file under wp-includes folder.

elseif ( false !== strpos($file, 'wp-content/uploads') )
				$url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
			else
				$url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir.

That’s it. That’s the solution to my gallery code problem. Thank you, emmanuel-georjon.

Upgraded to WordPress 2.7.1 and encountered a huge problem

I upgraded 2 sites a long time ago but it prevented me from upgrading the other websites. I had one huge problem, other than that everything went fine during the upgrade. But it was and is a major problem which I just cannot ignore.

I have a problem with the gallery feature at Weggis.net. When I upgraded from WordPress 2.7 to WordPress 2.7.1, the [gallery] code is not returning the right upload path. I am not using wp-content/uploads upload path. I have different folders for 2006, 2007 and 2008 pictures.

At present, the upload path should be wp-content/files/images/2009 but it is not the case. The pictures can be viewed in 2009 but the pictures in 2006, 2007 and 2008 cannot be viewed if I use the upload path wp-content/files/images/2009. The pictures are just there but they cannot be viewed using the [gallery] code. The [gallery] code is calling the upload path of the supposed to be present upload path wp-content/files/images/2009 for all the pictures including those in 2006, 2007 and 2008 folders instead of wp-content/files/images/2006 for 2006 pictures, wp-content/files/images/2007 for 2007, and wp-content/files/images/2008 for 2008 pictures.

As I have already upgraded to WordPress 2.7.1, and I don’t like to downgrade to WordPress 2.7, I decided to upload all the photos via FTP to wp-content/files/images without the year just to remedy the problem. I changed the upload path from wp-content/files/images/2009 to wp-content/files/images. Using the path wp-content/files/images, site visitors can view all the photos in 2006, 2007 and 2008.

The problem is, I would like to upload photos this 2009 at wp-content/files/images/2009 but doing that, site visitors will not be able to view the photos temporarily while I am uploading the photos at wp-content/files/images/2009 as the upload path is of course wp-content/files/images/2009. After uploading the pictures, I need to upload the photos again via FTP to wp-content/files/images to duplicate the photos in wp-content/files/images/2009. Then again, I have to change the upload path from wp-content/files/images/2009 to wp-content/files/images so all the photos can be viewed regardless of the year.

For the meantime, I am doing this process so that when the gallery will be fixed, it will return to normal just like when the site was still using WordPress 2.7. I had no problem with the gallery code with WordPress 2.7. The problem only occurred when I upgraded to WordPress 2.7.1, and I don’t think that it has something to do with the WordPress Plugins.

I have a suggestion though regarding the upload path. There is this option under Settings > Miscellaneous where we can organize uploads into month- and year-based folders. Why not include year-based folder only without the month folder? Then we do not have to change the upload path every time the year changes. I actually would like to use the option “Organize my uploads into month- and year-based folders” but for me, the month-based folder is not necessary.

Can WordPress add a year-based only folder option? Will this option require a lot of programming and changes to the core codes? I am not a programmer so I really wouldn’t know. I hope they will try to look at this option. I am crossing my fingers. 🙂

Upgraded to WordPress 2.7 “Coltrane”, Host Compatibility Problem

I upgraded four sites from WordPress 2.6.5 to WordPress 2.7. The upgrading went smooth except for one problem, and that is host compatiblity problem. I’m guessing here but I think it is really the problem.

First of all, I upgraded Sehdi.com from WordPress 2.6.5 to WordPress 2.7 but every time I accessed the dashboard and the other pages, the pages were hanging or crashing. I always had to refresh the pages. I thought it was just a browser problem. To find out, I upgraded Weggis.net hosted at another web host. The upgrade went fine. I had no problems at all.

With that, I upgraded SofieHofmann.com hosted at the web host where Sehdi.com is being hosted as well, just to see if my guess was right. I had the same problem accessing the dashboard and other pages. To confirm if the problem was really host compatibility, I upgraded Psap-parola.org hosted at another web host, but not where Weggis.net is being hosted. Upgrading Psap-parola.org from WordPress 2.6.5 to WordPress 2.7 went fine too.

I even used both Safari and Firefox just to test if it was indeed a browser problem but using both these browsers, the pages at Sehdi.com and SofieHofmann.com were still hanging and crashing.

Sehdi.com, Sofiehofmann.com and Psap-parola.org are being hosted here in Switzerland. What I like about my web hosts here is that, the pages are fast when being downloaded. Weggis.net is being hosted at Dreamhost. It is also fast but honestly, as I see it, not as fast as the three other sites hosted here in Switzerland.

I planned to transfer Sehdi.com and Sofiehofmann.com to another web host but I thought that it would take a lot of work as I have other sites riding on one of those domains. And so, as much I did not like doing it, I downgraded Sehdi.com and SofieHofman.com from WordPress 2.7 to WordPress 2.6.5.

I plan to upgrade these two sites once I already transferred them to another web host, and most probably one will be at Dreamhost. One problem I have if I transfer all the other sites to the other web host here in Switzerland, some Swiss web hosts are too security problem conscious (safe_mode is on), and so the built-in automatic upgrade of WordPress will not be put into use. I already tested it.

I could not even use the flash image uploader and the plugin automatic upgrade of WordPress as safe_mode is on. I can always ask my web hosts to turn it off but I think the way they think too. So I’ll just transfer the other one at Dreamhost. With Dreamhost, I can make use of the one-click install and one-click upgrade for plugins and same with the new automatic WordPress upgrade feature every time there is going to have a new version or release of WordPress.

I still have five more sites to upgrade, but having problem like this, I have to delay upgrading them until I will be able to transfer them to another web host.

I tried to fix the mod_security problem with the following codes at the .htaccess but nothing happened. I still can not use the flash image uploader and the plugin automatic upgrade features. I haven’t tried the other possibilities of solving this but if you have any tips, I will definitely appreciate it.

<ifmodule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</ifmodule>

Well then, if you are upgrading to WordPress 2.7, make sure that your web host have tested WordPress 2.7. I checked what my other web host have at this time, it is still WordPress 2.3.3. But I no longer use their tools, I install whatever I need to install on my own. The other web host, at least, they have WordPress 2.6.1.

Dreamhost has the latest WordPress 2.7, of course. Did you notice that I’m loving Dreamhost now? Oh well!

Related Links: Dreamhost, WordPress

Update:
I just thought that I should give you the link to check which web hosts are compatible with WordPress 2.7, hop on to Core Update Host Compatibility. If your web host is not on the list, ask your web host then.

I also did not discuss anything about the features and other problems here except host compatibility problem as I know a lot of people have written about it already. For example, Lorelle have written a very good article, some tips on upgrading to WordPress 2.7, hop on to Lorelle on WordPress – WordPress 2.7 Upgrade Tips.

Regarding the process on upgrading, do the usual. You can go back reading my other posts too as the process is still the same or hop on to WordPress and read Upgrading WordPress for instructions.

Upgraded to WordPress 2.6.5

Even if WordPress 2.7 will be released soon, I still upgraded all the blogs and sites that I am maintaining from WordPress 2.6.3 to WordPress 2.6.5. There is no WordPress 2.6.4 to avoid confusion when someone spread a fake release of WordPress 2.6.4.

WordPress 2.6.5 is a security fix solving one problem and three bugs. You can download it from the site and perform the normal process of upgrading or opt to just upload the 5 files.

wp-includes/feed.php
wp-includes/version.php

wp-includes/post.php

wp-admin/users.php

xmlrpc.php

Kindly read the official announcement about WordPress 2.6.5 at the WordPress.org Development Blog.

For more information, WordPress 2.7 will go live at WordPress.com tomorrow. If you don’t feel like testing WordPress 2.7 Release Candidate 1 in your own site, you can take a look at it there if you have a WordPress.com account. It may not be entirely the same with WordPress 2.7 that will be available at WordPress.org but at least you will have an idea what is coming.

Revised WordPress Theme for Weggis.net

I finished revising the WordPress Theme for Weggis.net. I did not change the web design of the site except the position of the images on other pages other than the one at the front page and the location page. Internally though, I changed a lot in the scripts.

I finally got rid of the tables containing the menu and the images at the top of the site. I transferred the text to its location now from where it used to be, like the one you see at the front page and the location page.

I made use of calling the photos and videos using the custom field feature of WordPress instead of embedding the photo all the time after uploading the photos and videos of the events. Because of the custom field feature of WordPress, I was able to call the photos and videos at random at the front page from the photos and videos pages. I don’t need to update the front page as well as the photos and videos pages. They will be updated automatically once I upload some photos or videos.

I also made use of the flash image uploader of WordPress. I used to embed the photos individually from a folder outside a WordPress installation. Now a days, I only upload the photos using the flash image uploader, and just changed the titles afterwards.

The filename of the photo is normally the title of the photo. With that, I needed to individually change the title of the photo. I do that because I don’t like to upload a photo with capital letters, without a dash nor underscore at the filename. I always like the filename in small letters but not when you’re looking at it in a page. If only, WordPress would be able to do something about changing the title at once only, unless I just don’t know. You can actually do that by accessing your database but that would be a hassle but that’s what I did anyway. 🙂

One more thing, every time I make a web design, I make sure that it’s XHTML and CSS valid. Weggis.net should have been but if you tried validating the front page and videos page of this site, you will see that they’re not XHTML valid. The reason for that is because of the embedded videos. The embed tag was not part of any standardized version of HTML so it produces an invalid markup. There’s a way to correct this but because the process is a little bit complicated I just opted not to do it. The other pages are valid anyway.

Update: I removed the videos at the front page.

Fluid Three-Column New WordPress Theme for Sehdi.com

It has been a year since I redesigned my web design site Sehdi.com. I again redesigned this site still using WordPress as a CMS. I just uploaded the new web design (version 3) yesterday. The new WordPress theme for Sehdi.com is a fluid three-column theme where the main content is being positioned in the middle for balance while one sidebar is on the left side and the other sidebar is on the right side of the main content.

Designing a fluid three-column theme where the main content is in the middle is not at all easy as I have to consider if it will look good at different browsers with different screen resolutions. So far, it looks good on different browsers. The site was tested at several browsers like Safari 3, Firefox 2, Firefox 3, Opera 8.5, Opera 9.2, Internet Explorer 6 and Internet Explorer 7.

Fluid Three-Column New WordPress Theme for Sehdi.com

It looks the same on the browsers that I mentioned with screen resolutions like 800×600, 1024×768, 1280×1024 and even bigger than 1280×1024. But I also limited the width so as not to expand the main content that much, if ever the screen resolution is 1440×900 or bigger.

I also would like to emphasize here that I always consider the 800×600 screen resolution every time I design a site. I think it is still important to do it considering the popularity of netbooks right now especially with 800×600 screen resolution. And if the smart phones have that screen resolution, isn’t that great?

Anyway, just to show you, the two images below are the old web designs of Sehdi.com (version 1 and version 2). If you read what I wrote last year when I redesigned this site, you will also see these images on that entry.

Old Web Design Version 2 for Sehdi.com Old Web Design Version 1 for Sehdi.com

WordPress Flash Uploader, Adobe Flash Player 10, Userplane Applications

I just redesigned Pandan.ph Website and made use of the gallery feature of WordPress. The downside was I was not able to use the WordPress Image Flash Uploader to upload the photos, only the normal WordPress Image Browser Uploader.

For clarification, Flash uploader is an image uploader making use of the flash so you can upload pictures in bulk while the Browser uploader is when you can only choose one file or photo to upload to your WordPress site.

I did not mind using the Browser uploader because I did not have too many pictures to upload. I was able to upload everything and Pandan.ph Website is now online with the new photo gallery.

When I finally uploaded the new WordPress theme of Pandan.ph, activated it, and then announced that it has been redesigned, I thought of changing its front page look and put a Live Web Chat into it. I already have an account with Userplane, so I thought of using one of its applications. Unfortunately, it was not showing up unless I upgrade my Adobe Flash Player. I downloaded the new Adobe Flash Player 10 and installed it.

With the new installation, I tested 3 Userplane applications to no avail. I surfed the web and looked for answers to the problem. According to Adobe site, and to my understanding, I should have uninstalled the Adobe Flash Player first before installing the new one. That I didn’t know. I do not even remember what version of Adobe Flash Player I was using before I installed the Adobe Flash Player 10. With the new information, the only way to uninstall the software was by using the Adobe Flash Player Uninstaller. I downloaded the Adobe Flash Player Uninstaller available at the Adobe site. I uninstalled the Adobe Flash Player and installed it again.

I thought everything will be resolved but no, the Userplane application was still giving me the message that I should upgrade to the new Adobe Flash Player. I thought again, maybe something went wrong with the installation and the Adobe Flash Player 10 I downloaded before was corrupted. So I downloaded the Adobe Flash Player 10 again. I uninstalled and installed the software but still to no avail.

I did not implement the Live Web Chat at the site. I also looked for other WordPress Live Web Chat Plugins but at that time I did not like to register again with another site. I thought that I will just implement the Live Web Chat later. I will still have to look for an alternative.

I resumed working as I am redesigning several of my sites right now especially the photo galleries. I tested uploading photos to my other WordPress sites, the Flash uploader was still not working. I surfed the web and again, looked for answers to this problem. I found out that WordPress Image Flash Uploader is not compatible with Adobe Flash Player 10.

I do not work too much with flash, so having read that it is better to use Adobe Flash Player 9 for the meantime, I downloaded Adobe Flash Player 9 from the Adobe site. I uninstalled Adobe Flash Player 10 and installed Adobe Flash Player 9.

Well, WordPress Image Flash Uploader worked but only in one of my sites. That site is in fact hosted with Dreamhost. I find it really funny because I always like my web hosts here in Switzerland but right now I’m getting quite satisfied with Dreamhost so far. I can only use the Browser uploader at the other sites being hosted at my 2 other web hosts. The Flash uploader does not work at all. The reason why I was not able to use the WordPress Image Flash Uploader with Pandan.ph because it is being hosted at one of my web hosts here, and not with Dreamhost. I will have to contact my other web hosts to know what is wrong.

I hope that this problem will be resolved soon. It’s not fun uploading photos one by one, you know. 🙂

Related Links: WordPress, Adobe, Userplane, Dreamhost

References:
WordPress › Support » Image/Media Uploader problems?
WordPress › Support » Flash Player 10 Beta breaks file upload
Flash Player 10 Beta | SWFUpload
Flash Player 10 – Continued | SWFUpload
Troubleshoot Adobe Flash Player for Intel-based Macs
How to uninstall the Adobe Flash Player plug-in and ActiveX control

New WordPress Theme for Pandan.ph Website

Finally, I was able to redesign Pandan.ph Website, still using WordPress as a CMS, and still based on the old web design of the site. There’s really nothing major that changed externally but internally a lot were needed to be updated. I revised the CSS and PHP scripts to make use of the photo gallery feature of WordPress.

I was using a javascript within WordPress for the automatic slide of the old photo gallery. I removed those javascripts and made use of the gallery feature of WordPress. There are no more automatic slide shows, just a simple gallery but at least site visitors can write their comments now at the individual pictures.

Regarding color, I finally changed the background color from dark blue to light blue. This is one thing that some of the site visitors suggested as they have a hard time looking at the site longer because of the dark blue color. One suggestion was to change the background into green. I use the green color at the bottom and at the main menu instead.

The image below was the old WordPress theme of Pandan.ph Pandan Antique Philippines Website.

Old WordPress theme of Pandan.ph Website

Other additional changes are the latest comments on the side bar instead of the web links, and the RSS feed subscription, making it quite really visible, now being linked to feedburner using feedproxy.google.com instead of being at the domain itself.

I now also use the WordPress Plugin FeedBurner FeedSmith to redirect the old RSS feed pandan.ph/feed to the new one at feedproxy.google.com/pandanph, WordPress Plugin ©Feed for copyright notice at the RSS feed, and Simple Recent Comments.

The WordPress Plugins are very useful, so if you like them, just grab them. 🙂

Updated on November 01, 2008

The old web design of Pandan.ph Website had two layouts. The front page, the other pages and its subpages were using a three-column layout while the News section was using a two-column layout, both with fixed width.

The new web design of Pandan.ph have also two layouts. The front page is using a three-column layout but the rest of the pages are using a two-column layout.

New WordPress theme of Pandan.ph Website New WordPress theme of Pandan.ph Website

The images above are the three-column and two-column layouts of Pandan.ph Website.

Upgraded to WordPress 2.6.3

I was guessing the other day that perhaps there will be no more WordPress upgrading to do. But in reality, at the back of my mind, anything could happen before a major release of WordPress 2.7 on November 10, 2008.

Well, yesterday, it was announced that there was a vulnerability at the Snoopy library. WordPress uses Snoopy in fetching the feeds that are being shown at the Dashboard. Have you seen those errors at the Dashboard too? Maybe this is related, I saw some incoming links appeared in my Dashboard when in fact, those sites are not really linking to your site.

So WordPress 2.6.3 was released as a security fix. Although the risk is not that high, WordPress opted to update immediately.

Don’t worry, you do not have to do the normal upgrading of WordPress. You have the option to just upload the file needed to fix the Snoopy library and the version file so to update it so that you will not see that message reminding you all the time that there’s a new version of WordPress. That’s exactly what I did.

Download WordPress 2.6.3, extract it, and upload class-snoopy.php and version.php files under the wp-includes folder. You can also opt to download the two files only at WordPress.2.6.3.

That’s it! It’s that easy!

Related links: Snoopy Vulnerability, Snoopy

Upgraded to WordPress 2.6.2, WordPress Plugin Automatic Upgrade

I finished upgrading all the sites using WordPress. I really had no plan to upgrade from WordPress 2.6 to WordPress 2.6.2 as I did not have any problem with it. I even skipped upgrading to WordPress 2.6.1. I know that WordPress 2.7 is going to be released this coming November. So, I thought I will just wait for WordPress 2.7.

But I changed my mind, so I finally upgraded all the websites using the publishing platform WordPress as a CMS (Content Management System). Upgrading to WordPress 2.6.2 did not cause any problem. Even when I upgraded several WordPress Plugins by clicking “upgrade automatically”. It worked just fine and no problem at all.

I actually just tested the WordPress Plugin Automatic Upgrade to see if it works, and if it is safe to use it. It worked, that is because I did the testing at the site where Dreamhost is the web hosting company. The last time I made use of it with a different web host, it did not work. I just got errors. But clicking “upgrade automatically” works with Dreamhost. I think this is again a plus for Dreamhost.

I will try to test this WordPress Plugin Automatic Upgrade at my other sites hosted at a different web host other than Dreamhost. I will see if I will still encounter any problems. As of the moment, there’s nothing to upgrade as I also upgraded all the WordPress Plugins by uploading them together with the WordPress 2.6.2 files.

By the way, I’m not talking about a certain WordPress Automatic Update Plugin here but the built-in One-click or Automatic Upgrade feature of WordPress which was included in WordPress 2.5 when it was released on March 29, 2008. It is different from the update notification which lets you know if ever there’s a new release of WordPress or there’s a new available updated version of a WordPress Plugin that you are using. The update notification feature was included when WordPress 2.3 was released on September 24, 2007.

I guess, no upgrading will be done until WordPress 2.7 which will be released on November 10, 2008 if everything will be fine as planned by WordPress.org.