Word Press

Socrates Premium Wordpress Theme

Socrates Premium Wordpress Theme

Get Instant Access

WordPress is a popular blogging tool that can be extended to create basic Web sites. Like Drupal, it has a rich developer and user community base and offers many plugins to extend the core framework. WordPress operates best when using a blog-style narrative to organize its pages.

Like Drupal 6, WordPress uses many smaller component files for its templates; however, the structure of a WordPress theme and the structure of a Drupal theme are quite different. To convert a WordPress theme to Drupal, you will need to combine some files and to split others into smaller components. WordPress will often use a function (ending with parentheses) to store the same kind of information that Drupal stores in a variable (starting with a dollar sign). These differences arise because of the rules created by the template engine used for each of the two systems.

A typical WordPress theme maps onto Drupal file names as shown in Table 3.1. A typical WordPress theme maps onto Drupal variable names as shown in Table 3.2.

Start with the following steps if you are given a WordPress template, but cannot easily install the blogging tool to confirm the output:

TABLE 3.1 WordPress and Drupal File Names

WordPress Drupal index.php page.tpl.php header.php page.tpl.php (incorporated into)

footer.php page.tpl.php (incorporated into)

404.php GUI administration function comments.php comment.tpl.php searchform.php search-block-form.tpl.php and/or search-

theme-form.tpl.php

1. Create a new folder with the name gollum.

2. Create a new .info file that describes your new theme. Be sure to include the name of your theme, a brief description, and the Drupal core version required by this theme. Use the WordPress theme screenshot for now. You may want to replace it later if there are significant enhancements made as part of the upgrade to Drupal.

3. Put a copy of the WordPress file index.php into the gollum directory and rename it page.tpl.php.

4. Throughout the new page.tpl.php file, replace the WordPress references to external files that describe structural components with their actual file contents. For example, replace get_header(); with the contents of the file header.php and get_footer(); with the contents of footer.php.

5. Copy the sidebar.php file into the new gollum directory and rename the file to block.tpl.php. In the new file page.tpl.php, replace get_side-bar(); with a variable representing the name of the region for this sidebar. Make sure this region is also defined in the theme's .info file (for example, gollum.info).

TABLE 3.2 WordPress and Drupal Variables

WordPress

Drupal

the_title();

$title;

the_content();

$content;

next_posts_link();

Handled by Drupal's pagination

6. Note the functions that were called from WordPress's sidebar.php file. These functions must be matched to blocks within Drupal. Additional information on blocks is available in Chapter 4. Once your Drupal theme is enabled, you will place these blocks into the appropriate region of your new template using the administration Web interface.

7. Move the contents of index.php, which relate to individual story items, into a new template file named node.tpl.php. This information may also be contained in the WordPress file single.php. Check both files to ensure you have migrated all of the WordPress theme components.

8. Check the WordPress file functions.php for additional theme information that may need to be migrated to Drupal either using a text-based tpl.php file or through Drupal's administration Web interface.

Was this article helpful?

0 0
Bigger Blogging Profits

Bigger Blogging Profits

Are You Ready to Start Writing? Times are very hard, and there is no reason to assume or imagine that things are going to improve any time soon. The world as a whole has undergone some very traumatic changes over the last few years, and the financial situation in most countries seems grim.

Get My Free Ebook


Post a comment