WYSIWYG Editor for your custom box

If you have a custom text box in the edit post page, and you want to have the built-in editor, it’s quite easy to do.
<?php
the_editor($content,’id’);

deprecated

use

wp_editor($content,’id’ . $post->ID);
?>

To get ajax data, you can call global tinyMCE object
tinyMCE.get(node_id).getContent();

Creating a custom widget

Here is the basic code to use to create a widget.

class myWidget extends WP_Widget {
function myWidget() {
// widget actual processes
parent::WP_Widget(false, $name = ‘myWidget’);
}

function form($instance) {
// outputs the options form on admin
}

function update($new_instance, $old_instance) {
// processes widget options to be saved
}

function widget($args, $instance) {
// outputs the content of the widget
?>
<li> …
</li>
<?
}

}
register_widget(‘myWidget’);

Theme Options

If you want to create a menu in wp-admin for Theme Options ( Appearance->Theme Options), you can start with this

http://themeshaper.com/2010/06/03/sample-theme-options/

Just download the zip file, search and replace “sample” of theme-options.php with your theme name.

in functions.php add

require_once ( get_template_directory() . ‘/theme-options.php’ );

then in your index.php ( and other template files) put the following at the top

$theme_options = get_option(‘sample_theme_options’);

For each include ( header.php, footer.php, sidebar.php, etc), do a

global $theme_options;

Then you can use $theme_options[‘option_name’]

WordPress post formats

WordPress 3.1 introduces post-formats. You have to activate this “feature” and it gives you a new admin box in the posts type. Although this isn’t a big new feature, it is quite common for sites to have quotes, videos, links, etc. Loop retrieves the post-format for each post, you can then use that to style the post.

Here is the link to codex documentation.

http://codex.wordpress.org/Post_Formats