Category Archives: Wordpress

Word wrap inside
 block

In the Arras theme that I use, text contained within a <pre></pre> block was not being wrapped, causing formatting problems in I.E. (e.g. the sidebar would be forced below the post) and reducing readability. A solution was found on this site. For my solution, adding the following code to the end of /wp-content/themes/arras-theme/css/styles/default.css solved this problem quickly and easily.


pre {
 overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
 white-space: pre-wrap; /* css-3 */
 white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
 white-space: -pre-wrap; /* Opera 4-6 */
 white-space: -o-pre-wrap; /* Opera 7 */
 /* width: 99%; */
 word-wrap: break-word; /* Internet Explorer 5.5+ */
}

Manually Backing Up WordPress

To backup, first create a tarball of the website


[root@Kepler Cbattles]# tar -cvjf WordPress.tar.bz2 ./blog

and then dump the MySQL database


[root@Kepler Cbattles]# mysqldump --add-drop-table -h localhost -u wordpress -p wordpress | bzip2 -c > blog.bak.sql.bz2

Put the two files in a safe place. Easy.

Security Note: These files are created in the webroot directory. This means that they are accessible by anyone. Either create them in a safe location or move them after creation.


Caveat lector — All work and ideas presented here may not be accurate and should be verified before application.

Fixing the in Post Thumbnails in Arras Theme

Solution was found on the Arras forums. This link explans a small coding change to the filter.php file located at wp-content/themes/arras-theme/library.

The following code is on line 103 of filters.php:

$lead = get_post_meta($post->ID, ARRAS_POST_THUMBNAIL, true);
if ( $lead) {

replace with the following:

$lead = get_post_meta($post->ID, ARRAS_POST_THUMBNAIL, true);
if ( $lead && arras_get_option('single_thumbs')) {

That will get the “Post Thumbnail” radio button to work again…

WordPress and memory management

I’m running LAMP and WordPress2.8.6 on a Sun Fire X2100 64-bit Opteron 146 server. When I first setup this server, it was for static html and light duty email & ftp usage, so the base 512M memory worked fine. On the initial install of WordPress and for a few days after, everything looked like it was running smoothly. Recently though, I began noticing a large delay in processing web pages so I took a look at the memory usage. Well I was maxed out on physical RAM and using another 500M or so of swap. Load averages during my own usage would shoot up to 6 or so. So apparently PHP was swapping out every time a dynamic request came through. Firstly, the automatic YUM daemon was utilizing 30% of my physical RAM, so I shut that off.

# chkconfig --levels 0123456 /etc/init.d/yum-updatesd off

but I could still see my memory usage creep up and then start to swap. So a quick trip to purloin some DDR1 unbuffered ECC memory later, 2G is installed and everything is running beautifully. 770M usage in core after the reboot with alot of headroom should hopefully fix the issue for good.

Now one of the questions may be why did I have memory issues in the first place? 512M should be plenty for a LAMP server running Postfix+Spamassasin. And if I had set Fedora up as a bare bones server install from the beginning, those questions would be valid. But I’m also running the full Gnome desktop and its associated bloat. But 2G ought to keep everyone happy. When I get around to upgrading from FC7, I’ll strip the system down to bare essentials.