WordPress Theme Tutorial
Teil 1 - Teil 2 - Teil 3 - Teil 4 - Teil 5
sidebar.php - Die Sidebar, wichtiger Bestandteil eines jeden Blogs
Die Sidebar kann man mit folgenden Befehlen formatieren:
- wp_get_archives(’type=monthly’) gibt das Archiv, nach Monaten getrennt, aus.
- wp_list_cats(’sort_column=name’) gibt die Kategorien nach Namen sortiert aus.
- get_links(’-1′, ‘<li>’, ‘</li>’, ”, 0, ‘name’, 0, 0, -1, 0); gibt die Links (in einer Aufzählung) nach Namen sortiert aus.
- wp_register() gibt den Link zur User-Registrierung aus.
- wp_loginout() der Login/Logout-Link
- bloginfo(’rss2_url’) und bloginfo(’comments_rss2_url’) sind die Link zum Beitrags- und Kommentar-Feed aus.
- include (TEMPLATEPATH . ‘/searchform.php’) damit wird das Suchformular eingebunden.
Ein Beispiel für eine Sidebar könnte etwas so aussehen:
<h2>Seiten</h2>
<ul>
<?php wp_list_pages('title_li='); ?>
</ul>
<h2>Archiv</h2>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
<h2>Kategorien</h2>
<ul>
<?php wp_list_cats('sort_column=name&optioncount=0&hierarchical=0'); ?>
</ul>
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
<h2>Links</h2>
<ul>
<?php get_links('-1', '<li>', '</li>', '', 0, 'name', 0, 0, -1, 0); ?>
</ul>
<h2>Meta</h2>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href="<?php bloginfo('rss2_url'); ?>" title="RSS 2.0 Feed">RSS 2.0 Feed</a></li>
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="RSS 2.0 Feed">RSS 2.0 Kommentare</a></li>
<?php wp_meta(); ?>
</ul>
<?php } ?>
<h2>Suchen</h2>
<ul>
<li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li>
</ul>
searchform.php - Die Suche wird erstellt
Hier wird das Suchfeld formatiert.
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>
<input value="" name="s" id="s" type="text" />
<input value="Suchen" type="submit" />
</p>
</form>
WordPress Theme Tutorial
Teil 1 - Teil 2 - Teil 3 - Teil 4 - Teil 5
0 Responses to “#4 Eigenes WordPress Theme / Template erstellen - Tutorial - HowTo”