WordPress: Ein minimales Theme
Die Dateistruktur von umfangreichen WordPress-Themes ist oft anspruchsvoll. Zum Ausprobieren von WordPress genügt ein minimales Theme mit nur zwei Dateien.

Aktuelle WordPress-Themes sollen vielen Ansprüchen genügen. Entsprechend ist auch ihre Konfiguration oft anspruchsvoll. Gerade zum Ausprobieren von WordPress geht es auch anders. Der folgende Code zeigt, was notwendig ist, um ein minimales WordPress-Theme aufzubauen. Das Theme besteht nur aus zwei Dateien.
style.css
/*
Theme Name: Minimal Theme
Description: WordPress-Theme mit minimaler Grundausstattung
Version: 1.0
Author: Jonas Hellwig, kulturbanause.de
Author Uri: https://kulturbanause.de
*/
index.php
<!doctype html>
<html>
<head>
<meta charset="<?php bloginfo('charset');?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php bloginfo('name'); ?> – <?php wp_title(); ?></title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
</head>
<body>
<header>
<h1><a href="<?php echo home_url('/'); ?>">
<?php bloginfo('name'); ?></a>
</h1>
<p><?php bloginfo('description'); ?></p>
</header>
<hr>
<nav>
<ul>
<?php wp_list_pages('title_li','');?>
</ul>
</nav>
<hr>
<main>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2><a href="<?php the_permalink(); ?>">
<?php the_title(); ?></a>
</h2>
<?php the_content(); ?>
</article>
<hr>
<?php endwhile; ?>
<nav class="post-nav">
<?php previous_posts_link(); ?>
<?php next_posts_link(); ?>
<?php previous_post_link(); ?>
<?php next_post_link(); ?>
</nav>
<?php endif; ?>
</main>
</hr>
<footer>
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?></p>
</footer>
</body>
</html>