July 26, 2009

Wordpress Charted Archives Plugin

His thought process -as he wrote in ‘Now With Navigation and Charted Archives‘- was that someone new to the site could see the graph and very easily get a feel for the frequency of his posting and I liked it a lot. I have seen similar features before, but not linked to the archives nor executed as beautifully as his. This is why I decided to make it a plugin.

I’ve got it live in my sidebar now, but as it may not be there for ever, this is how it looks.
Charted Archives
If you like it just download the plugin. Install the plugin and you can use it in three ways:

  1. As a widget: go to Themes > Widgets to add the widget to your sidebar. Add the number of months to display in the widget properties, it defaults to zeven.
  2. As a php tag in a template: <?php Charted_Archives($number_of_months_to_show) ?>
  3. Or use a shortcode in a page. [chartedarchive months=”12″] (where 12 can be any number of months).
Update: there was an error in the CSS link which is now corrected. The download link above reflects the new version.

Update 2: I added a shortcode for easier use in pages.

January 27, 2008

New Wordpress CMS theme

screenshot.png

I have received a lot of traffic on my article about Wordpress as CMS lately and thought it would be nice to release a new CMS theme. It’s extremely easy to use and available for download now

Tips for using

  • Use pages for CMS content
  • Create a page named Home with page order 0
  • Create a page named Blog and assign the Blog template to it
  • Set Home as front page and Blog as posts page
  • It supports sub-pages, only shown when the parent is selected

March 22, 2007

CMS theme (version 2.1)

cms theme

In one of my previous posts I wrote about using Wordpress as a CMS. To demonstrate the capabilities I created this “Wordpress CMS theme”. It features a static frontpage with news, post and page searching, a weblog with widget support and easy access for non-technical authors. The theme can also be used as theme for a weblog.

Download it here (108KB). Version 2.1 is tested for Wordpress 2.1.x, valid XHTML and almost valid CSS (except for the two IE hacks).

March 17, 2007

How to: multiple blogs, one Wordpress installation

When you have a weblog and play with it a little you will quickly gather more of them. For production, development, maybe testing and possibly various domains. Then upgrading Wordpress to a new version becomes a lot of work. It would be a lot easier if you would only need one Wordpress installation with their own database and upload folder. This is Wordpress multi user, or multi site or domain if you prefer. It is not hard to achieve. Just follow this tutorial.

Choose multi site or domain

While they may seem the same, there is an essential difference between these. Multi site would be set up as: www1.domain.com and www2.domain.com where multi domain would be setup as www.domain1.com and www.domain2.com. You could even have these types mixed but that would make it a little more complicated. For now we assume you would like to host www.domain1.com and www.domain2.com.

Install the Wordpress files

Just install Wordpress like you would for one website. The point all domains / sites to the folder where you installed it.

Create a config file, here comes the magic

In the config file you determine which domain is requested and select the database (and if needed database user, server and password) based on that. For the site version use $parts[0] instead of $parts[1].

$host = $_SERVER['HTTP_HOST'];
$parts = explode('.',$host);
if ($parts[3] = "") {
    $domain = $parts[0];
} else {
    $domain = $parts[1];
}

switch ($domain) {
case "domain1":
    $db = "database1";
    break;
case "domain2":
    $db = "database2";
    break;
}

define('DB_NAME', $db);
define('DB_USER', 'user');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'hostname');

Create the databases

Wordpress needs you to create the empty database before you set it up. If you point to a domain of which the database is not created yet, you will be informed Wordpress can select the database. When the database is there, you get the setup screen.

Finalize

The make sure things don’t get mixed up you should change some of the default settings in the admin panel. At Options > Miscellaneous set the upload folder to wp-content/uploads/domain/ and don’t forget to create the corresponding folder.

February 21, 2007

Is home or is frontpage?

Version 2.1 of Wordpress introduced native support for a static frontpage, which only has been supported by plugins before. When using this option however, the is_home function doesn’t work. This is because is_home is supposed to return true for the “blog” home page, where your most recent posts show up, not the “front” home page. An is_frontpage function is not available yet.

Therefore I whipped together this small plugin, called is_frontpage. Just download the plugin drop the file in your plugin folder, activate the plugin through the admin interface and the is_frontpage function is available to you. Use it just like the is_home function. It returns true if you’re at the frontpage you set, otherwise it returns false.

Syntax

To be complete here the syntax: is_frontpage()

if (is_frontpage()) {
do something
}

February 19, 2007

Wordpress as CMS in five steps

Using Wordpress as CMS is much more simple as of version 2.1. It only takes five simple steps to do it, without the need to hack into complicated code.

  1. Create a page named home as startpage and give it page order 0.
  2. On the top of index.php add (between php tags) /* Template Name: weblog */ .
  3. Create an empty page named weblog, give it page order 99 and assign the weblog template to it.
  4. In the admin section under options > reading, select home as front page and weblog as posts page.
  5. Create a menu with wp_list_pages(’sort_column=menu_order&title_li=’). (Already taken care of in the CMS theme).

Use pages for your CMS content and make sure the page order is between 0 and 99. This way the first page in the menu is home and the last page is the weblog. Of course you can vary if you want.

Download the original CMS theme or the new CMS theme and optionally use a plugin to make the pages searchable.