Move WordPress admin bar to the bottom

I’m building a WordPress theme that has a fixed top menu bar. Hence, the admin bar supersedes it ; and that’s not nice. So I just wanted to move it to the bottom of the page, where nothing lies.

You will just need to add the following code to your functions.php file:
Continue reading…

Add a Table of Contents in WordPress articles

I use to have TOCs in articles when this site ran DokuWiki. But by default, WP doesn’t provide this ability. After a few Googling, I found the Table of Contents Plus plugin.

I choose this one for two main reasons:

  • it can automatically insert a TOC in WP since “X or more headings are present” ;
  • it has various looks embedded to match your theme.

You can have a look at a rendered example here.

Hope it helps.

Manually change WordPress’ home and siteurl in MySQL

In my tidy process, I had to copy WordPress from one host to another, then access it from various URLs so that the production and the development versions were both accessible from the same public IP. To duplicate the data in a fast manner, I dumped the SQL data and tarred the WWW directory. The problem is that WordPress’ home and siteurl are kept the same between those instances. And since you try to access the administration zone, you’re redirected to the original location… To modify the duplicated instance, you can configure WordPress straight from MySQL.

Here are the directions:
Continue reading…

Automatic WordPress installation

Here’s a quick trick that allows automatic installation of WordPress on an HTTP server.

The normal process is: browse to wordpress.com, grab the archive locally, upload to your server, unzip and run the installer. Sometimes, you even have to unzip locally and then upload the whole sets of files to the server.

The automatic process can be done using Instant Install.
Continue reading…

Optimize PHP on NetBSD

On a NAMP (NetBSD, Apache, MySQL, PHP) server, you can get a faster PHP rendering using eAccelerator.

First of all, install the php53-eaccelerator package.
Then, configure PHP to use it and the system to allow memory allocation:

# vi /usr/pkg/etc/php.ini
(...)
extension=eaccelerator.so
[eaccelerator]
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.shm_only="256"
eaccelerator.debug="0"
(...)
# sysctl -w kern.ipc.shmmax=536870912
# vi /etc/sysctl.conf
kern.ipc.shmmax=536870912
# /etc/rc.d/apache restart

According to ApacheBench, the initial “Time per request” was 3 sec. Using eAccelerator, it goes down to 1.9 sec.

Source: Optimize PHP