Current musing:

Using contenteditable to test css page layouts

This should be obvious, but I just realized that one could use the the HTML5 contenteditable feature to test page layouts. “Contenteditable” is a fancy little tag attribute that allows the user to edit the content contained in the element from the browser.

For example, Read more…

downloads

These guides are free, but if you have found them useful then please consider donating $2. Hey, that's less then the cup of coffee your drinking right?

subscriptions

« Blog home
New section done

I’ve finished writing a new section of my Everyman’s guide to wordpress. JJ inspired me so much I worked hard today to get something done. I now have instructions and screen shots on how to write and manage posts as well as an overview of all the options on the manange panel.

I’m not reallly planning on releasing it until I can get a bit more done, but if you want it let me know.

UPDATE: The newest version of WordPress sports a hot new look. Unfortunately that makes some of my information and ALL of my screenshots out of date. Someday I hope to actually update everything, but because I do this in my spare time this project is tabled indefinitely for now.


Back on the dashboard

A while back I posted instructions on how to customize the dashboard RSS feed to your own liking. Well, while looking at my dashboard just now (uncustomized), I found this fantastic article by Owen Winkler at asymptomatic.net.

He’s got a great summary of things that can be done to your Dashboard, including a plugin to disable the thing entirely.

My recommendation? Leave it alone. You never know when you might find a jewel of a post like this one which can tell you how to get rid of it ;-)


Change WordPress Dashboard RSS feed

If you have installed WordPress for a client, it doesn’t make a lot of sense to have the Dashboard that greats them everytime they login display the latest posts from the WordPress development blog. It can even scare them when security updates are posted.

So why not change that feed to your own blog, maybe your business blog used to tell your clients about specials you are running?

It’s easy you only need to edit one the index.php file located in your /wp-admin/ directory. Visually that’s:

/wp-admin/
|
|–index.php

Step 1: Backup

As usual backup the file first. If you mess this file up you may not be able to login anymore. (relax it’s not that big of a deal, that’s why you make backups!)

Step 2: Edit the file.

Scroll down to line number 127, it’s near the bottom. The section looks like this:

<p><?php _e("Below is the latest news from the official WordPress development blog, click on a title to read the full entry. If you need help with WordPress please see our <a href='http://codex.wordpress.org/'>great documentation</a> or if that doesn't help visit the <a href='http://wordpress.org/support/'>support forums</a>."); ?></p>
<?php
$rss = @fetch_rss('http://wordpress.org/ development/feed/');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<h3><?php _e('WordPress Development Blog'); ?></h3>

Make the following edits:

  • On line 129 by swap the URL there with the URL of your preferred blog’s feed.
  • Delete line 127 or edit the text inside the parenthesis to remove or change the explanatory paragraph.
  • Edit the text on line 132 inside the parenthesis to reflect the title of the blog that you are grabbing the feed from.
  • Make sure that all the text you insert is inside quotation marks inside the parenthesis, like so (“…”). If you need to include quotation marks in your text be sure to escape them by putting a backslash in front of them, like so \”.

Here’s how I changed mine.

<p><?php _e("Below is the latest news from Lucid Green's customer support blog. If you need and assistance please don't hesitate to email support at <a href='mailto:help@lucidgreen.net'> help@lucidgreen.net.</a>"); ?></p>
<?php
$rss = @fetch_rss('http://www.lucidgreen.net /supportblog/?feed=rss2');
if ( isset($rss->items) && 0 != count($rss->items) ) {
?>
<h3><?php _e('Lucid Green customer support blog'); ?></h3>
<?php>

Save the file and your done!


WordPress for high traffic

If you, like me, rarely pay attention to the WordPress dashboard’s imbedded feeds then you probably missed Owen Winkler’s fantastic post about optimizing WordPress for high traffic sites.

WordPress can handle high traffic, a fact that needs to get a lot more publicity. Owen tells you how to make it possible.


Simple hack to extend the WYSIWYG editor in WordPress

The default TinyMCE WYSIWYG editor is pretty basic. I really wanted to extend it to make it a little more functional.

I wanted to add a drop down box that would let me set custom styles on elements and I wanted a drop down box that would let me make selections into headers H1, H2, etc. Surprisingly it’s pretty easy. You only need to edit one file.

Here’s what you do, you will be editing the “tiny_mce_gzip.php” file located in /wp-incldes/js/tinymce/ directory. Visually that’s

/your_root_directory/
|
|–/wp-includes/
    |
    |–/js/
        |
        |–/tinymce/
            |
            |–tiny_mce_gzip.php

Step 1: Backup

backup this file! If you mess it up it’s your own fault, don’t complain to me.

Step 2: Add the buttons

Open the tiny_mce_gzip.php file and go to line number 110. It’s near the bottom. The section looks like this:

$mce_buttons = implode($mce_buttons, ',');
$mce_buttons_2 = apply_filters('mce_buttons_2', array('styleselect','formatselect'));
$mce_buttons_2 = implode($mce_buttons_2, ',');
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
$mce_buttons_3 = implode($mce_buttons_3, ',');
$mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera'));
$mce_browsers = implode($mce_browsers, ',');

The variables (those things with $’s in front of them) that read “$mce_buttons…” define which buttons will appear on the editor’s control section. They are numbered and that tells you which row the buttons will appear on. So the default editor only has one row and all those buttons (not shown here because of length) include the buttons to bold, italicize etc.

To add a new button you just have to include the button name (explained later) in the appropriate button variable’s array. So to add the two buttons I wanted to add in row two you look at line number 112 and add the names ‘styleselect’ and ‘formatselect’ into the array like so:

$mce_buttons_2 = apply_filters('mce_buttons_2', array('styleselect','formatselect'));

This will add two drop down lists to a new row on the editor. One will give you access to styles, which we will set next, and another which will let you select HTML tags to wrap around text like H1, H2 and PRE.

Step 3: Define custom styles

Scroll down just a few lines to line 120. the section looks like this:

initArray = {
mode : "specific_textareas",
textarea_trigger : "title",
width : "100%",
theme : "advanced",

Add a new line right below the squiggly bracket, “{“, so that your new code looks like this:

initArray = {
theme_advanced_styles : "Green text=green-text;Special quotes=special-quotes",
mode : "specific_textareas",
textarea_trigger : "title",
width : "100%",
theme : "advanced",

You’re style declarations go in the quotes after “theme_advanced_styles :” and they are formated like so: “what to show in the box=the css class name“.

In my example you will have two styles available in the drop down box “Green text” and “Special quotes”. Highlighting any text in the editor, or selecting any tag in the path viewer and clicking one of these drop downs will apply that the css rule class=”green-text” or class=”special-quotes” respectively. You can then add those classes to your site’s style sheet and customize away.

That’s it your done. Save the file and try it out.

Edit (1/9/2007): According to johnol’s comment below there are certain types of content that you cannot add due to WordPress filtering it out. Apparently, in order to prevent hacking. So You can’t add a tables button to your TinyMC editor it would seem. You can get more info about these filters at: http://codex.wordpress.org/Plugin_API#Filters

Button list

Here is a list of buttons that you can add to the editor, most of them are self explanatory. To get more info see the TinyMCE documentation.

bold
italic
underline
strikethrough
justifyleft
justifycenter
justifyright
justifyfull
bullist
numlist
outdent
indent
cut
copy
paste
undo
redo
link
unlink
image
cleanup
help
code
hr
removeformat
formatselect
fontselect
fontsizeselect
styleselect
sub
sup
forecolor
backcolor
charmap
visualaid
anchor
newdocument
separator