Sivel.net  Throwing Hot Coals


WordPress Maintenance Mode Without a Plugin Part 2

A few days ago I wrote a post about WordPress Maintenance Mode Without a Plugin. A common question that I got afterwards was whether or not the maintenance page could be styled. The answer, is yes it can be.

After wp-settings.php determines whether or not to put the blog into maintenance mode it checks to see if there is a file titled maintenance.php located in WP_CONTENT_DIR which is by default wp-content/.

Simply create a file at wp-content/maintenance.php containing the code you want to display the for the maintenance page. Below is a sample of code based off of the default maintenance page.

<?php
$protocol = $_SERVER["SERVER_PROTOCOL"];
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
    $protocol = 'HTTP/1.0';
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
?>

<html xmlns="http://www.w3.org/1999/xhtml">

<body>
    <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>
</body>
</html>


<?php die(); ?>

Modify as needed, add some css, some images and there you go.

Code CoolStuff HowTo PHP Snippet WordPress

Congratulations to the WordPress Community for a Successful 2.8 Release

With WordPress 2.8 having been released and amassing over 64,000 downloads in the first 12 hours, I wanted to take a few moments to give my congratulations to the WordPress team for another great release.

Many thanks go out to all of those who contributed code for the 2.8 release. I know many of you worked hard to help get this release where it is today. In total there were 153 people who contributed code to WordPress 2.8. Here is the list of people who contributed:

Aaron Campbell, Abel Cheung, adferguson, akd907, Alex Rabe, anderswc, Anton Shevchuk, arena, Askapache, Andrew Ozz, Beau Lebens, bernzilla, bkrausz, brh, brianwhite, caesarsgrunt, ceenz, CharlesClarkson, CharlieHamu, chineseleper, chmac, chrisbliss18, christmasboy81, Cimmo, clwill, Scott Reilly, danlee, dcole07, Dion Hulse, Demetris Kikizas, Denis de Bernardy, designsimply, develish, docwhat, Donncha O Caoimh, drossy, dwc, dwenaus, emartin24, empireoflight, ev3rywh3re, Federico Bond, Austin Matzko, fuggi, futurix, Lester Chan, GM_Alex, gmpfree, gortsleigh, GregMulhauser, hailin, hakre, hudatoriq, Benedict Eastaugh, Jacob Santos, jamescollins, jbsil, jcraig90210, jdub, Jeremy Clarke, Jennifer Hodgdon, John Blackbourn, johnconners, johnkolbert, JohnLamansky, Joseph Scott, Joost de Valk, jsixpack, JulienV, kambiz.k., kamiyeye, Kuba Zwolinski, Lloyd Budd, lusuonline, makibo, Malaiac, mark8barnes, markedwards, Mark Jaquith, mastermind, Matt Mullenweg, mattwalters, MattyRob, Michael Adams, mercurix, mgriepentrog, mgsisk, MichaelH, MidnighToker, minusfive, mrmist, Mr Pete, Nick Momrik , mystyman, natethelen, Nathan Rice, Nazgul, nbachiyski, neoxx, Nicholas91, nightgunner5, Noel Jackson, novalis_dt, Samuel Wood, pamelatech, Paveo, peaceablewhale, PeteHoliday, peterkz, piouPiouM, pishmishy, pne, PotterSys, projct, ranchnachos, Daniel Jalkut , richcon, ridgerunner, Ryan McCue, roganty, ruslany, Ryan Boren, Sam_a, Sam Bauers, scohoust, scribu, simek, Simon Wheatley, sirzooro, Matt Martz, srobbin, st3ff3n, stringfold, tellyworth, Charles Frees-Melvin, TimButterfield, tomontoast, topncal, Thorsten Ott, turboguy, Txanny, UnderWordPressure, Alex, Vladimir Kolesnikov, Peter Westwood, Will Norris, wnorris, yoavf, zedlander, zekrap, zeronex, zeo, znarfor

CoolStuff News WordPress

Shadowbox JS WordPress Plugin v3.0.0.0 Released

The Shadowbox JS WordPress plugin has been updated to version 3.0.0.0. This is a large update to the plugin. The majority of the plugin has been rewritten to load only the minimal amount of code needed for either the admin or frontend. New to this release is Shadowbox 3.0b1, programmatic loading of Shadowbox only when needed, selection of which Shadowbox players to load. See the change log for a full list of changes.

There are several important things to take note of:

  • PHP 4 Support Dropped
  • Additional Skins Removed
  • Custom skinning now requires 2 filters, see the FAQ for more information
  • The FLV player is disabled by default requiring you to agree to the licensing of the JW FLV Player before it can be used

If you are upgrading from one of the beta releases of this plugin you should use the option to reset to defaults after updating.

For support questions please see http://forum.sivel.net/viewforum.php?id=4.

News Plugins Shadowbox WordPress

WordPress Maintenance Mode Without a Plugin

Every so often someone asks a question in the WordPress IRC channel that sparks my interest, and in this case the core maintenance mode functionality was one of those questions. I’ve known for sometime that WordPress has it’s own maintenance mode functionality since core upgrades were added, however I had never really looked into the functionality. Hooking into this functionality is really quite simple and effective.

Start by creating a file in the root of your WordPress install (on level with wp-settings.php) called .maintenance. Note the preceding dot like a .htaccess file; in Linux this is considered a hidden file. In this file add the following code:

<?php $upgrading = time(); ?>

This code will basically cause the maintenance page to display until you remove the .maintenance file. In wp-settings.php there are 2 checks to see if it should display the maintenance page. First, it makes sure that the .maintenance file exists. Second, it checks that the current time minus the time specified by the $upgrading variable is less than 10 minutes. Using the code above will insure that it is always less than 10 minutes since time() - time() == 0. If you want it to display for a certain period of time you would want to use:

<?php $upgrading = 1234567890; ?>

For your usage you would want to replace 1234567890 with the unix formatted timestamp of the time minus 10 minutes at which you want the maintenance page to stop displaying.

For example if I wanted the maintenance page to stop displaying at November 14, 2013 at 20:13:00, I would really set the $upgrading variable to November 14, 2013 at 20:03:00. Notice the 03 instead of 13. In unix time this would look like 1384459380. And the code needed for the .maintenance file would be:

<?php $upgrading = 1384459380; ?>

Take note that if you use a specific time in the .maintenance file and you do not remove the .maintenance file, your users will see your site and not be affected, however in the admin you will see a notice stating, “An automated WordPress update has failed to complete - please attempt the update again now.” Deleting the .maintenance file will remove this notice.

I’m sure that this functionality could be wrapped in a plugin, or even better an option added to the core code in the admin. However, I am happy with just manually creating the file.

For information on modifying or styling the maintenance page see WordPress Maintenance Mode Without a Plugin Part 2.

Code CoolStuff HowTo PHP Snippet WordPress

Simply Show IDs WordPress Plugin v1.2 Released

The Simply Show IDs WordPress plugin has been updated to version 1.2. New to this version is support for WordPress 2.8 which includes listing of category, tag and user IDs. See the change log for all changes. Enjoy!

Asides Plugins WordPress

WordPress Twitter Hash Tag Widget and the New Widget API

Recently I attended WordCamp Mid-Atlantic, and took notice of the area of the site that listed all of the Twitter status updates that included the #wordcampmidatl hash tag. In fact a number of people took notice of this feature and thought it was a great idea. Yesterday, Brad from WebDevStudios asked me what plugin was used on the WordCamp Mid-Atlantic site so it could be used on the WordCamp Chicago site, and without knowing of such a plugin I recommended several approaches to achieve the same thing.

I ended up, out of curiosity, writing the functional code to do it and handed it off to WebDevStudios so they could get it over to the WordCamp Chicago site owner. After handing off the code apparently both I and WebDevStudios began wrapping the code into a widget. I chose to take the route of using the new Widgets API that will be introduced into WordPress 2.8.

This gave me some quality time with the new Widget API which, I personally feel, is a great improvement for widgets in WordPress.

I have not yet requested hosting for this plugin on in the WordPress Plugin Repo. So for now the download will remain hosted on this site. For anyone curious about the new Widgets API feel free to download the plugin and poke around. If you have and comments or suggestions for this plugin please let me know! I have just recently started into the world of Twitter and know that with as popular as the service is that this could become a very useful plugin.

On a side note I have added some caching capabilities to the plugin so that in the event that the connection to Twitter fails, as it so often does, it will simply serve the cache from the last successful attempt.

Please note that as this plugin uses the new Widgets API introduced in WordPress 2.8 that it will require WordPress 2.8 to function.

Download Now!

CoolStuff News Plugins WordPress

Good News for the Shadowbox JS Plugin

Michael J. I. Jackson has just recently released Shadwobox 3.0 beta. I have undertaken a huge rewrite of the plugin to both accommodate Shadowbox 3.0 and to make the plugin better overall. The rewrite is nearly complete and already in place on this site. There are many improvements and new features on their way with this new version so please stay tuned. One thing to make special note of, is that this plugin will drop PHP4 support and require PHP5.

Asides News Plugins WordPress

Adding Additional Links to the Output from wp_list_pages Part 2

Earlier this month I wrote about “Adding Additional Links to the Output from wp_list_pages”. I have recently realized that the process of adding new or additional links could be easier. Rather than manually editing the plugin or function every time you want to add a new link or remove a link we can leverage existing WordPress functionality to handle this.

The existing WordPress functionality that we will leverage are Links/Bookmarks.

We will start with the code. Add the following code to your themes functions.php or as a plugin.

add_filter('wp_list_pages', 'add_bookmarks_to_menu');
function add_bookmarks_to_menu($output) {
        $bookmarks = (array) get_bookmarks('hide_invisible=0&category_name=wp_list_pages');
        foreach ( $bookmarks as $bookmark ) {
                $output .= "<li><a href='{$bookmark->link_url}' title='{$bookmark->link_name}'>{$bookmark->link_name}</a></li>n";
        }
        return $output;
}

Now we head to the WordPress admin and browse to Links->Add New. Type the name as you want it to show up in your menu, the web address of your link, add this link to a new category called ‘wp_list_pages’, select ‘Keep this link private’ and click ‘Add Link’.

Placing the link in a category called ‘wp_list_pages’ will allow us to grab only links from that category and selecting ‘Keep this link private’ will keep it from showing up in the Links/Blogroll/Bookmark section of your site.

Enjoy!

Code PHP Snippet WordPress

Poll for New OPs in WordPress IRC Channel Opened

Over the past few months to a year I have noticed a lack of OPs in the WordPress IRC Channel. In the recent days there have been several times when an OP was needed but no one had OP access. I brought this to the attention of Matt Mullenweg via email over the weekend with hopes of getting new OPs in the channel. It seems as though Matt has come through by setting up a poll at http://surveys.polldaddy.com/s/3e0fcdaf55f1baed/.

For those of you who use the WordPress IRC channel, please help out by completing the survey and listing the users that you think would make good OPs in the channel.

I won’t be shy, and will come straight out an say that I would be honored to be an OP in this channel. I spend a large majority of my time in this channel, probably amounting to over 40 hours a week, helping users as best I can. If you decide that I would make a good OP and want to include me in your poll, my IRC nick is sivel.

WordPress

Shadowbox IE8 Woes

With the release of Microsoft Internet Explorer 8 and the high number of questions I have been fielding about Shadowbox.js not working under the newly released IE8; I figured I would work on a hack that would allow the Shadowbox JS plugin to work with IE8 until Michael J. I. Jackson releases a version that natively supports IE8. I intend on releasing an update to the Shadowbox JS plugin soon to include IE8 support. Stay tuned for the release.

Asides Plugins WordPress