WordPress
0.72

Weblog / News Publishing Tool

Requirements - Installation - Template(s) - Query String Usage - XML-RPC (Blogging APIs) - Post Via Email - Notes

Requirements:

The link will help promote WordPress and is its only mean of promotion.

WordPress is built from b2, which comes from Michel V. We wouldn't be here without him, so why don't you grab him something from his wishlist? You can also support the WordPress developers.

This document is currently beta stage, we'll be updating it extensively as WordPress matures. There is also online documentation under development.

Installation:

New users: 5-minute install.

  1. Unzip the package in an empty directory.
  2. Copy wp-config.sample.php to wp-config.php. Open wp-config.php in a text editor and modify the variables as explained in the comments. Comments are lines that start with /* or //
  3. Upload everything. This release is designed to sit in your root folder, IE the folder where your WordPress-powered page will reside.
  4. The weblogs.com cache file needs to be writable by the web server. CHMOD 666 the weblogs.com.changes.cache file.
  5. Launch wp-admin/install.php in your browser. This should setup the MySQL database for your blog. If there is an error, double check your wp-config.php file, and try again. If it fails again, please go to the support forums and make a post with all the information about the failure (error messages, etc), and your setup (the PHP and MySQL versions on your server, and the browser you were using). Note the password given to you.
  6. Go to wp-login.php and sign in with the login "admin" and the password given to you by the install script. Then click on the menu 'My Profile', and change the password. Note: you need javascript enabled to launch the profile popup window.

Some notes:

Upgrading from b2 v0.6.1 to WordPress v0.7:

Templates:

First notes:

Notes about parameters:

  1. Some template tags can accept optional parameters between the parentheses ().
  2. To add a parameter to a tag, enclose it between quotes and put it between the ().
    Example: <?php my_tag('my parameter'); ?>
  3. You may have to put several parameters, for that you separate them with commas.
    Example: <?php my_tag("first param", "second param"); ?>
  4. The order of parameters is important. If a function accepts 2 parameters and you only want to set the second one, you still have to provide the first one, and so on for any number of parameters.
    Example: <?php my_tag("", "second param"); ?>
  5. Some template tags, like the_date(), display something only if in some conditions. They generally accept parameters to display something before and after them only when they display something.
    Example: <?php the_title("<h1>", "</h1>"); ?> would display <h1>title of the post</h1> only if the post has a title

Template tags:

<?php the_date() ?>
the date of the post. example: 03.07.01 (default is dd.mm.yy).
the date is displayed only on new days. for example if you got 10 posts on the same day, the date for this day is displayed only once.
Parameters:

<?php the_time() ?>
the time of the post. example: 18:37:00 (default is hh:mm:ss)
Parameters:

Note: you can change the way the date & time are displayed in the Options page.
once you understand the format strings for the date & time (explained in the Options page), you can change the display right on the template: for example, the_date("d.m.Y") to have dates like 25.12.2001, the_time("B") to have Swatch Internet Time.
If you change the display of the date on the template, changing it from the options page won't have any effect.br />
Note about the_date(): if you want all your posts to bear the date, you'll have to use the_time() instead, with a date format string. for example, to have all your posts show like "25.12.2001 @ 8:04:50 AM" you'll have the_time("d.m.Y @ g:i:s A"). you can also repeat this template tag 2 times with 2 different formats: the_time("d.m.Y") for the date, and then later the_time("g:i:s A") for the time of the day.

<?php the_weekday() ?>
This displays the day of the week when the post was made. It works like the_time(), in that it would appear at every post. Weekdays can be obtained with a custom date format string in the_time() or the_date(), but for non-english weekdays you have to edit day-month-trans.php
Note: this tag is OBSOLETE, the_time() and the_date() now use weekdays/months from day-month-trans.php

<?php the_weekday_date() ?>
Like the_weekday(), but works like the_date(), in that it would appear only on new days.
Note: this tag is OBSOLETE, the_time() and the_date() now use weekdays/months from day-month-trans.php
Parameters:


<?php the_ID() ?>
the ID (number) of the post.

<?php the_title() ?>
The title of the post.
Parameters:


<?php the_content() ?>
The text of the post.
Parameters:

For example <?php the_content("read more","0","blah.php") ?> would display a link to blah.php, with the link text read more, and won't display the teaser message.

To enter an extended entry, just type <!--more--> in your entry. The part before that comment is the teaser, the part after it is the extended entry. To force the extended entry not to show the teaser message, type <!--noteaser--> somewhere in your entry.

To enter an entry with several pages, just type <!--nextpage--> in your entry to start a new page.


<?php next_post() ?>
Displays a link to the next post(s). (Generally you might want to use that tag only in single-post templates)
Parameters:


<?php previous_post() ?>
Displays a link to the previous post(s). (Generally you might want to use that tag only in single-post templates)
Parameters:


<?php next_posts() ?>
Display the URL portion of a link to the next set of posts.
Generally you would use this in a template to navigate to the next "set" of posts when the "Show Options" settings for the site is set to "posts paged". The displayed string can be used to construct a link. When the site options are not set to 'posts paged", the next and previous functions will display nothing.
Parameters:


<?php next_posts_link() ?>
Displays a full link to the next "set" of posts only if show options set to "posts paged" and only if there is another page or partial page of data.
Parameters:


<?php previous_posts() ?>
Displays the URL portion of a link to the previous posts.
Generally you would use this in a template to navigate to the previous "set" of posts when the "Show Options" settings for the site is set to "posts paged". The displayed string can then be used to construct a link. When the site options are not set to 'posts paged", the next and previous functions will display nothing.
Parameters:


<?php previous_posts_link() ?>
Displays a full link to the previous "set" of posts only if show options set to "posts paged" and if there is a previous set, otherwise nothing is displayed.
Parameters:


<?php posts_nav_link() ?>
The function displays a complete navigation set of links including a user definable "separator" with the ability to supply a the text string to be used for the "previous" and "next" links.
The default result will produce the following string:

<< Previous Page :: Next Page >>

Parameters:


<?php link_pages() ?>
Displays links to the pages of the post if it's a multiple pages post.
Parameters:


<?php the_author() ?>
The author of the post.
Depending on the user's profile settings, it can display whether their nickname, login name, first name, last name, both first& last name, or last & first name. look below for more author-related template tags.

<?php the_category() ?>
the name of the category the post belongs to. you can as an admin add categories, and rename them if needed. default category is 'General', you can rename it too.

<?php the_category_ID() ?>
The ID (number) of the category the post belongs to. This is static data thatyou can use, for example to associate a category to an image, or a css style.

<?php trackback_rdf() ?>
This will include the RDF data that can be used by some weblog tools to locate your posts' trackback URLs.
You should put this tag after the <?php the_content() ?> tag in your template, or just before the end of the loop.

<?php get_links_list() ?>
This tag is out of the WordPress loop.
It will output a list of all links defined in the Links Manager, listed by category, with category headings, using the settings in the Links Manager to control the display and sorting of links within the categories, and output it as a nested HTML unordered list. That sounds more complicated that it really is. 
Parameters:

<?php dropdown_cats() ?>
This tag is out of the WordPress loop.
It will display a list of <option name="x">category-name</option>, where x is the number of the category and category-name is the name of it.
Parameters:

you can use it like this:

<form action="<?php echo $PHP_SELF ?>" method="get">
<?php dropdown_cats() ?>
<input type="submit" name="submit" value="view" />
</form>


<?php list_cats() ?>
This tag is out of the WordPress loop.
It will display a list of the categories, with links to them.
Parameters:

<?php bloginfo() ?>
This tag is out of the WordPress loop.
It outputs info about your weblog.
Parameters:

<?php single_post_title() ?>
This tag is out of the WordPress loop.
It outputs the title of the post when you load the page with ?p= (see 'Usage' section for explanation). When the weblog page is loaded without ?p=, this tag doesn't display anything. Generally, you could use it like this:
   <title><?php bloginfo('name') ?><?php single_post_title() ?></title>
Parameters:

<?php single_cat_title() ?>
This tag is out of the WordPress loop.
It outputs the title of the category when you load the page with ?cat= (see 'Usage' section for explanation). When the weblog page is loaded without ?cat=, this tag doesn't display anything. Generally, you could use it like this:
   <title><?php bloginfo('name') ?><?php single_cat_title() ?></title>
Parameters:

<?php single_month_title() ?>
This tag is out of the WordPress loop.
It outputs the name of the month when you load the page with ?m= (see 'Usage' section for explanation). When the weblog page is loaded without ?m=, this tag doesn't display anything. Generally, you could use it like this:
   <title><?php bloginfo('name') ?><?php single_month_title() ?></title>
Parameters:

Note: The above three functions can be used together to produce the Title of the page:
   <title><?php bloginfo('name') ?><?php single_post_title(' :: ') ?><?php single_cat_title(' :: ') ?><?php single_month_title(' :: ') ?></title>
Only one, if any, of these functions will produce output, thus the page Title can be customize to the task being done.


More about the author of the post ? Here goes:

<?php the_author_email() ?> - the author's email.
<?php the_author_url() ?> - the author's url.
<?php the_author_email() ?> - the author's number of posts.
<?php the_author_icq() ?> - the author's ICQ number.
<?php the_author_aim() ?> - the author's AIM handle.
<?php the_author_yim() ?> - the author's Yahoo Messenger handle.
<?php the_author_msn() ?> - the author's MSN Messenger handle.
<?php the_author_posts() ?> - the author's post count.
<?php the_author_login() ?> - the author's login name in WordPress. If you want some static data about the author, this is what you're searching for. You can, for example, associate a picture with an author, like this: <img src="pictures/<?php the_author_login() ?>.jpg" border="0">
<?php the_author_ID() ?> - the author's ID number in WordPress. This number is automatically set when the user registers: to see the ID of an user, go to the Team page. This is static data too, so you can use it like the_author_login() in associating stuff with authors.


Tags for permalinks
are:

<?php permalink_anchor() ?>
this will display <a name="..."></a>, replacing "..." with the ID or the title of the post in the database.

Parameters:

<?php permalink_link() ?>
this will display the name of the file followed by #ID to link to the post, in the month archive if archive-mode is "monthly".
note: this tag does not display the link, for this you've got to type <a href="<?php permalink_link() ?>">text of the link</a>.
Parameters:


<?php permalink_single() ?>
this will display the name of the file followed by #ID to link to the entire post (the linked page will also show the extended text on that post if it is an extended entry, and the comments).
note: this tag does not display the link, for this you've got to type <a href="<?php permalink_single() ?>">text of the link</a>.
Parameters:



Tags for comments, trackback, and pingback are:

<?php comments_popup_script() ?>
This will include the javascript that is required to open comments, trackback and pingback in popup windows.
You should put this tag before the </head> tag in your template.
Parameters:


<?php comments_popup_link() ?>
This will display the link to open comments in a popup window, with the number of comments.
To edit the popup window's template, edit the file wp-comments-popup.php (it's the default one for comments popup).


Parameters:


<?php comments_link() ?>
This is a bit like permalink_link, it will display an URL to the comments page, but again you'll have to create the link tag.

Note:
The same tags exist for TrackBack and Pingback, respectively named 'trackback_link()' and 'pingback_link()'. They take the same parameters.

Parameters:


<?php comments_number() ?>
This displays the number of comments that have been posted on this post. Example: "5 comments".


Parameters:

Example: <?php comments_number("no comment","1 comment","% comments") ?>

This tag differs from v0.5's tag because in v0.5 and prior, it would only display a number, not a text with it, so you could have terrible things like "1 comments" (doh !)

Necessary: <?php include("wp-comments.php") ?>
you'll put this line where you want the comments to be placed on your page.
typically, under the post itself. don't worry, the comments only appear if the page is called in the comments mode. (like this: url?c=1)


Tags that go in wp-comments.php: (these are easy too)

<?php comment_author() ?>
<?php comment_author_email() ?> - displays the e-mail address, but not the link
<?php comment_author_url() ?> - displays the url, but not the link

<?php comment_author_email_link() ?> - displays a link to the comment's author's e-mail
<?php comment_author_url_link() ?> - displays a link to the comment's author's website
Parameters for comment_author_email_link() and comment_author_url_link():

<?php comment_author_IP() ?> - displays the IP of the comment's author
<?php comment_text() ?>
<?php comment_date() ?>
- unlike the_date(), this tag appears on every comment
<?php comment_time() ?>

Parameters for comment_date() and comment_time():

<?php trackback_url() ?>
This tag is out of the WordPress TrackBacks loop.
It will output the URL to TrackBack the post, that other people can copy and use in WordPress's posting interface to trackback this post.

In wp-comments.php, like in the main template file, please keep the first PHP lines, the "while" lines, and the "}" lines.

You can modify the form, but do not remove "<?php echo ... ?>" and all the name="..." attributes.


To include your archives:

<?php get_archives() ?>

Parameters for get_archives():

Query String Usage:

WordPress relies a lot on the query string, these variables passed with the URL (note: to pass variables in the querystring, preceed the first variable name with a '?' question mark and every other variables with a '&' sign.)

Most of the time you won't have to do anything about it, but if you want to know how it works, it's here:

How to use the query string:

index.php?m=200107 will display the month of July 2001.

index.php?m=20010701 will display all posts from July 1st, 2001.

index.php?w=20 will display the posts from the 20th week of the year, where January 1st is in the first week (according to PHP).

index.php?p=50 will display the post labeled #50 in the database.

index.php?s=blue+house will display the posts that match the search request "blue house".
here is the code for a simple search box:

<form name="searchform" action="<?php echo $PHP_SELF ?>" method="get">
<input type="text" name="s" />
<input type="submit" name="submit" value="search" />
</form>

index.php?cat=1 will display all posts that belong to category #1 (1 is the default). you can add/rename/delete categories from WordPress's interface.

index.php?author=1 will display all posts from the author #1

index.php?p=50&c=1 will display the comments and a form to add a comment below the post.
you should use this variable only with p=, example: index.php?p=50&c=1.

index.php?p=50&page=1 will display the first page of post #50. this, again, should be used only with p=, for individual entries.

You can also mix these variables, example: index.php?m=200107&s=hotdog will display the posts that match the search request "hotdog", but only in July 2001.

XML-RPC Interface:

WordPress has an XMLRPC interface. Currently supported APIs are the Blogger API, metaWeblog API, and the MovableType API. There are talks about a new API that would cover a lot of weblog/CMS systems in the future: when it's ready, WordPress will support it.

The Blogger API has been completely emulated on WordPress, with some little differences:

If you use blogger.newPost, your post is submitted without title and in category #1.

However, you can type <title>my title</title> and/or <category>2<category> in the body of your post to make its title be 'my title' and its category be #2 (refer to your categories section to find out the ID numbers of the categories). b2 would then delete that extra info from the body of your post once it is posted.

The metaWeblog and MovableType APIs are currently supported with the following exceptions:


Extended entries in the MovableType API are automatically converted to/from the WordPress <!--more--> tag.

You can now post to your WordPress blog with tools like BlogBuddy, Bloggar, WapBlogger (post from your Wap cellphone!), Radio Userland (which means you can use Radio's email-to-blog feature), Zempt, NewzCrawler, and other tools that support the Blogging APIs! :)

Your XMLRPC server/path are as described here: if you login to WordPress on http://example.com/me/wp-login.php, then you have:

There's also a b2-specific method: b2.getCategories. Request it with 3 strings: blog_ID (use '1'), username, password. The response is an array of structs with strings categoryID and categoryName.

Post via Email:

You can post news from an email client!
But first you'll have to edit the options on the options screen, filling the appropriate values for your POP3 email account (this interface doesn't support IMAP yet, only POP3, sorry).

Once you have edited the options, you can make your webserver execute wp-mail.php every set amount of time (depending on your host's performance, this script can be resource intensive, so don't make it run every minute or you'll be kicked).

You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your wp-mail.php URL.

Preliminary advice:

It is strongly advised to send your email as text-only (Outlook and Outlook Express default to 'html', which may cause problems), but HTML email could work (the script would strip all your html tags though...).

It is also advised not to use your public email address, but create a new one especially for this script. If you use your public email address and the script goes crazy posting every email on your blog and deleting all your emails, I can't take responsibility for this.

Make sure you delete any email sent to your blog in your 'Sent' folder too, just in case (you don't want someone to find your login and password in the 'Sent' folder).

The script will delete the emails that were used to post stuff on your weblog if it successfully posted your stuff. If it didn't manage to post, the email is not deleted.

How to post:

Now to post something, here's how your email should look like:

To: address@example.com (you set it in the config file)
Subject: blog:the post's title (you can change 'blog:' in the config file)
Body:
login:password (example: Jack:Starwars)
The content of the post, blah blah blah.
More blah blah. ___

Subject must start with 'blog:', or any string you set in the config file (so that the script doesn't check EVERY email in your mailbox).

Body's first line must always be login:password, else the script will just skip the email.

If you don't use '___' (or any body terminator that you set in the config file), the script will post the whole body, which is not what you want if you send email with Yahoo or Hotmail (you don't want their ads on your blog, do you ?).

Special cases for mobile phone email:

Some mobile phone service providers may allow you to send email with your mobile phone or PDA, but on such devices you can't always include line breaks. In such case, you have to set use_phoneemail = true in the options, and then here's how you write the email:

To: address@example.com
Subject: blog:the post's title :::
Body:
login:password ::: The content of the post, blah blah blah.___

You will have to append ':::' (or whatever string you set in the config file) after the subject, and after the login:password.

Some mobile phone service providers may not allow you to set a subject, and they'll make the subject be the first characters of the body, in which case you would send an email like this:

To: address@example.com
Body:
blog:the post's title ::: login:password ::: The content of the post, blah blah blah.___

Notes:

On multi-user:

New users can register with wp-register.php. Then you (as an admin) click the "+" next to their name on the Team page in admin to upgrade their level to 1 or more, so they can post. If you don't want an user to post anymore, just click "-" until their level is 0.

Note: you can now disable users registration altogether from the config file.

Levels:

Usually, you'll want to have a team of only level 1 users except you. ;)

Note: you can modify an option on the option screens, to enable new users to post once they've registered.

If you don't want users to register on your blog at all, just delete wp-register.php once you've registered your user account.

Final notes:

Copyright notes: