About Konstantin Obenland

Konstantin Obenland ist Professional Scrum Master I sowie Certified Scrum Product Owner und widmet sich seit einiger Zeit den Prozessen in der agilen Softwareentwicklung und der erfolgreichen Implementierung und Optimierung von Scrum in Entwicklerteams. Ausserdem beschäftigt er sich mit WordPress-Entwicklung und hat schon mehrere Plugins veröffentlicht.

HolidayCheck Blog Poland

I created this website (run on WordPress) as part of my job as a working student at HolidayCheck. The design was mostly taken over from its German counterpart (Designed by Thomas Witt).

Extensive customization was requested, only to name a few:

  • Making it possible to run two sites on one WordPress install (traffic: ca. 1000 visits/day)
  • Internationalizing the existing theme
  • Customized post editor, based on user role
  • Possibility to assign certain categories to a particular author (admin can access them all)
  • Dynamically building of author overview page (based on name and post count)
  • Dynamically creating the Google Analytics code (now deprecated)
  • Click-Tracking for Google Analytics

Service Excellence Center Konstanz

As part of a project in my Project Management course, we created a concept for this website, which I put into action. Again I used WordPress as CMS. Biggest challenge here was merging pages and posts, without the possibility of custom post types (this was pre-3.0), in the “Projekte” category.

The layout is based on the GreyMMOZine Theme by ChiQ Montes with lots of customization (i18n of templates, redesign of the layouts and edited backround).

Sitemap: The WordPress Way

Due to the popularity of my earlier article about creating a WordPress Sitemap without a Plugin and my growing familiarity with the WordPress core, I decided to introduce another possibility. With this one, there are no custom database queries necessary, it solely depends on  already existing WordPress functions:

/**
 * Builds the Sitemap and echoes the HTML
 *
 * @echo Sitemap
 */
function sitemap() {

    $category_array = get_categories(array(
        'exclude_tree'    =>    24
    ));

    $sitemap =    "<h3>" . __( 'Posts','domain' ) . "</h3><ul>";

foreach ( $category_array as $category ) {
    $sitemap .= "<li>".__('Category: ', 'domain').'<a href="'.get_category_link($category->cat_ID).'" title="' . sprintf( __( "View all posts in %s" , 'domain'), $category->name ) . '">'.$category->name."</a><ul>n";
    $post_array = get_posts(array(
        'post_type'    =>    'post',
        'cat'        =>    $category->cat_ID
    ));

    foreach ( $post_array as $post ) {
        $post->post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
        $sitemap .= "<li><a href="" . get_permalink($post->ID) . '" title="' . esc_attr($post->post_title) . '">' . $post->post_title . "</a></li>";
    }
    $sitemap .= "</ul>";
}

$sitemap .= "</li></ul>";
$sitemap .= "<h3>" . __( 'Pages','domain' ) . "</h3><ul>";
$sitemap .= wp_list_pages(array(
    'echo'        =>    false,
    'title_li'    =>    false,
    'exclude'    =>    '343,487,491'
))."</ul>";

 echo $sitemap;
}

The first function obviously grabs all the category objects from the database. This function has a number of possibilites to customize – read about them in the WordPress Codex.

$category_array = get_categories(array(
    'exclude_tree'    =>    24
));

Next, wie go through the categorie objects and fetch the associated posts. Now we can build the unordered list. I slotted the “the_title” filter ahead of the link, to give my plugins the opportunity to work their magic.

foreach($category_array as $category){
    $sitemap .= "<li>" . __('Category: ', 'domain') . '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '">' . $category->name . "</a><ul>";
    $post_array = get_posts(array(
        'post_type'  =>    'post',
        'cat'        =>    $category->cat_ID
    ));

    foreach ( $post_array as $post ) {
        $post->post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
        $sitemap .= '<li><a href="' . get_permalink($post->ID) . '" title="' . esc_attr($post->post_title) . '">' . $post->post_title . '</a></li>';
    }
    $sitemap .= "</ul>";
}

And after all posts have been taken care of, there are only the pages missing (ich exluded the footer pages to only display pages with relevant content):

$sitemap .= wp_list_pages(array(
    'echo'       =>    false,
    'title_li'   =>    false,
    'exclude'    =>    '343,487,491'
))."</ul>";

That’s all there is to it!

Translating WordPress Made Easy

So far, when working on WordPress projects, I always hit a point in time, where it was necessary to create or alter .po files for themes or plugins, to be able to use them with a German website.

Especially when working with more than one translator (possibly not even having the necessary software) or having to support multiple languages, it becomes very complex and time-consuming. A few weeks ago, I coincidentally came across a plugin, which I have since installed on all(!) my WordPress installations: Codestyling Localization by Heiko Rabe.