The Shadowbox JS WordPress plugin has been updated to version 2.0.4.1. New to this version is Internet Explorer 8 support by way of the X-UA-Compatible meta tag. This hack is disabled by default because…well…it is a hack. To enable IE8 support visit the Shadowbox JS settings page in the WordPress admin and set ‘Internet Explorer 8 Hack’ to ‘true’. Enjoy!
The Shadowbox JS WordPress Plugin has been updated to version 2.0.4.0. More big changes in this version. Now using domready events for all javascript libraries other than ‘None’ for initialization of Shadowbox.js before the site is completely loaded, support for custom shadowbox.js skins by use of a filter and numerous other changes. Check the change log at the link provided. Enjoy!
Recently I have been responding to numerous questions about the update/install functionality in WordPress for core, plugins and soon themes. I wanted to take a few moments to make some clarifications and to inform people of the requirements.
To update the WordPress core or update/install plugins or themes without having to enter your FTP/SSH information you have 2 options:
- Define the required constants in wp-config.php
- Make the necessary file permission/ownership configurations required to use a direct update/install instead of using FTP or SSH
For information on achieving the first option see take a look at the follow links:
The second option is a little more confusing for some people. Most people think that as long as they give full write access to the plugins or wp-content directories that they will not be asked for their FTP/SSH connection information. Unfortunately, this falls short of the requirements for performing a direct update or install. There are 4 possible methods for performing the file operations. The operations are ‘direct’, ‘ftp’, ‘ssh2’, and ‘ftpsocket’. The direct method allows php to do all of the file operations on its own without requiring any external dependencies. For the ‘direct’ method to work, the web server, and by extension php, needs full write access to the files it is trying to modify.
WordPress determines if it can perform a direct update or install by performing a few file operations and looking at the ownership of those file operations. Here are the steps that WordPress goes through when making the determination.
- Returns a suitable temporary directory to create a test file (the following is in the order of precedence)
- If WP_TEMP_DIR is defined it will return this value
- If WP_CONTENT_DIR is writable by the web server user it will return the path to the wp-content directory
- If you are running PHP 5.2 or newer it will determine the systems temp directory using sys_get_temp_dir()
- As a fall back it will return /tmp/
- Creates a unique file via touch() in the temporary directory returned in step 1 and returns the path to this temporary file
- If the file system owner of wp-admin/includes/file.php and the file system owner of the temporary file that was created are equal to each other then it will use the direct method and then the temporary file is removed
- The check that is performed uses the file system owner of wp-admin/includes/file.php and not the run time user of that script
- This is, in my opinion, the most reliable way to make sure that the user the web server is running as can make modifications to all of the WordPress files
- If the check failed to use the direct method it will check for the possibility of using:
- SSH2
- FTP
- Sockets (fsockopen, fwrite, fread)
So with the above steps for determining whether or not the ‘direct’ method can be used there are several things that can be done to allow WordPress to use the ‘direct’ method.
- If you want to do core upgrades as well as plugin and theme upgrades/installs you can change the ownership of all of the WordPress files to be that of what the web server is running as
- If you only want the ability to do plugin and theme upgrades/installs you can modify the ownership of wp-content, all of its contents and wp-admin/includes/file.php to be that of what the web server is running as
- If you want to do core upgrades as well as plugin and theme upgrades/installs you can set permissions on all of the WordPress files and all of its contents that give the web server write access to those files and then add a filter to the filesystem method by way of a plugin or addition to functions.php
- If you only want the ability to do plugin and theme upgrades/installs you can set permissions on wp-content and all of its contents that give the web server write access to those files and then add a filter to the filesystem method by way of a plugin or addition to functions.php
I am sure there are about 100 different combinations of the above methods, so feel free to experiment.
Since #1 and #2 are fairly self explanatory I will skip those and explain #3 and #4.
- Change the file/directory permissions of either the WordPress root or wp-content and all of their contents so that the web server user has the ability to modify those files and write to those directories
- Add the following bit of code to either your themes functions.php or to a plugin
add_filter(‘filesystem_method’, create_function(‘$a’, ‘return “direct”;’));
In methods 1 and 2 we simply fulfill the requirements needed by WordPress to return the ‘direct’ method on its own. In methods 3 and 4 we have made sure that the web server can do what it needs to the WordPress files and because of this we can tell WordPress to always use the direct method.
I believe that should about cover it. If I have made any mistakes or forgot to include something please let me know. Enjoy!
The Page Restrict WordPress Plugin has been updated to version 1.6. New to this update is a meta box for easy restriction on the write/edit page pages, restrict viewing comments on restricted pages and restrict page content in search results. Enjoy!
The Public Post Preview WordPress Plugin has been updated to version 1.1. New to this update is not limiting public previews to posts in draft or pending status. The plugin now allows public previews of any post that is not in ‘publish’ status. Enjoy!
If you are like me, then you are often referring to the function and template tag documentation on the WordPress Codex. My friend, Andy Stratton, got tired of having to open google, typing in the function name and then clicking on the link to the codex returned in the search results. To make his life easier he wrote WPLookup. WPLookup gives you a simple search box that will redirect you to the documentation for the function or if it doesn’t exist, redirect you to the WordPress.org search where you can see documents containing the function or text you are looking for.
To make the service even better you can integrate it into your web browsers search bar for even faster lookups.
I have taken his service one step further and written an IRC bot that is currelty sitting in the WordPress IRC Channel. To use this bot type something in the form of .codex get_pages
and it will query WPLookup and return the resulting URL back to the channel.
See the following links for his release announcements about this new service:
- Find WordPress Function and Template Tag Documentation - Fast
- New WPLookup Features - Set WPLookup as a browser search engine
I was recently contacted by Nick Stackenburg in regards to my Lightview JS WordPress plugin. It seems as although the license stated that I was allowed to freely distribute the Lightview code, there was a per domain license involved as well. Since I am in conflict with his license I am removing the Lightview JS plugin completely from the WordPress Plugin Repository as all versions have contained the Lightview code.
For the users of my Lightview JS plugin I am recommending that you switch to either my Shadowbox JS plugin or to the Lightview Plus plugin written by Thorsten Puzich. Users switching to the Lightview Plus plugin should purchase the domain license from the Lightview project page.
One common question in the WordPress IRC Channel is how to add external links, or links to content other than pages, to the output of wp_list_pages, usually not that exactly but that is what they mean. You can of course modify your theme by inserting
<li><a href="http://example.org">Example.org</a></li>
<p>
immediately following the wp_list_pages function however, this is not always the best solution. In my case I am working on developing a theme for distribution and testing it in the best way possible by running it as my main theme on my site. Since I want extra links to appear there and I don’t want to have content in the theme that will not be distributed to users, filtering the output of wp_list_pages works wonderfully.
You can put this following code in your themes functions.php, or in a plugin. Since I am trying to keep from modifying my theme, a plugin is the better option.
add_filter('wp_list_pages', 'add_forum_link');
function add_forum_link($output) {
$output .= '<li><a href="http://forum.example.org/">Forum</a></li>';
return $output;
}
The above code will add a link to a forum at http://forum.example.org/.
Enjoy!
Comments
Posted February 27, 2009 by sivel
I am releasing updates to 4 of my plugins today. The plugins that have been updated are AJAXify FAQ-Tastic, Moderate Selected Posts, Possibly Related Recent Posts and Lightview JS. The most important updates to these plugins are PHP Notice fixes and enqueue-ing scripts and styles that were previously just printed to the head. You can see each plugins respective change log at the links provided. Enjoy!
Comments
Posted February 26, 2009 by sivel
One of the biggest things that irritates me when using the [gallery] shortcode is that style tags are inserted into the post content. Why does this irritate me? Because this does not validate as XHTML 1.0. Luckily the fix is quite easy. Add the following code as a plugin or to your themes functions.php and say goodbye to the style tags in your post content.
add_filter('gallery_style', create_function('$a', 'return preg_replace("%%s", "", $a);'));
One side effect to doing this is that the CSS normally outputted to into your post content is no longer output at all. You will need to add the CSS to your themes css file, usually style.css. The following css is the default output:
The width for .gallery-item is a dynamic value determined by the columns attribute specified in the [gallery] shortcode. The default is 3 columns which makes the width 33%, floor(100/$columns)
.
I have also written a plugin called Gallery Shortcode Style to Head which does a forward lookup to determine if a post uses the [gallery] shortcode and if it does, prints the default CSS to the head. While the plugin works and performs its function, I still prefer a solution that has less overhead associated with it, hence the code provided in this post.