Category Archives: WordPress

All things WordPress on Linux. I don’t do WP on Windows as there is no point. If you have a licenced Windows server install Hyoer-V and run up a virtual linux system for apps like WordPress. Its a much more robust process than trying to make Windows do things it was never designed to do.

WordPress FTP prompt for Upgrade or Update

There are a lot of posts around about the FTP prompt when preparing an upgrade and all (almost all) reference the same information which is to enter specific settings in the wp-config.php file for the FTP site, username, & password.

Alternatively, I prefer this option which allows the admin user with the correct permissions to avoid the FTP aspect altogether.

In the same wp-config.php file in the WordPress root, around line 10 it will look like this:

[php]
* This file is used by the wp-config.php creation script during the
* installation. You don’t have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/

// ** MySQL settings – You can get this info from your web host ** //
[/php]

Just insert a few lines and add the 3 DEFINE lines as per the example below:

[php]
* This file is used by the wp-config.php creation script during the
* installation. You don’t have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/
define(‘FS_METHOD’, ‘direct’);
define( ‘FS_CHMOD_DIR’, 0775 ); // change these settings to match your apache account
define( ‘FS_CHMOD_FILE’, 0664 ); // change these settings to match your apache account

// ** MySQL settings – You can get this info from your web host ** //
[/php]

The key is the CHMOD entries. In my case the cpanel / WHM server is configured for the apache account to act as the group controller of the files. So to upload and modify files in the Worpress directory it needs write permissions as group not owner.

WordPress and child page listing

Sometimes I want a listing of the child pages to be embedded in the text of a page. This could be done manually but then maintenance of the site is a nightmare (unless it is a really static site!)

So adding the following code into the relevant page template for the WordPress site works a treat.

[php]
<?php
$children = wp_list_pages(‘title_li=&child_of=’.$post->ID.’&echo=0′);
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
[/php]

While it is not a rule, this related page listing is probably going to appear underneath any of the page text content, so look for the following in the page template and place the child page code below this line.

[php]
<?php the_content(); ?>
[/php]

WordPress and Breadcrumbs

Some WordPress themes that I like don’t have a breadcrumb option. So the next best thing is a plug-in and the one I like is Breadcrumbs Plus.

The first thing to do to use this, after installation, is confirm which file you need to edit and I’ll guess it will be header.php for the theme but it could be somewhere else depending on your theme and where you want the breadcrumb to appear.

Once you know where, just add this section of code to the appropriate file, and magic will happen.

[php]
<?php if ( function_exists( ‘breadcrumbs_plus’ ) ) breadcrumbs_plus( array( ‘singular_post_taxonomy’ => ‘category’ ) ); ?>
[/php]