Aufbau eines WordPress-Templates
12/2009
Header: Blogtitel + Beschreibung (hier kommt auch das Header-Bild rein)
1 2 3 | <div> <h1><?php bloginfo(''name''); ?> <?php bloginfo(''description''); ?></h1> </div> |
Inhalt: Beinhaltet den gesamten Text
1 | <div id="content"> - hält alle postings |
Posting: Der sogenannte “Loop”, der für die Darstellung des Postings zuständig ist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?> <!-- hier beginnt das div für ein posting --> <div class="post"> <!-- die Überschrift des postings --> <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <!--das datum des postings--> <?php the_time(__(''d. F. Y'')) ?> <!-- div für postingtext --> <div="entry"> <?php the_content(__(''.... weiterlesen'')); ?> </div> <!-- kategorien + link zu den kommentaren + link für admin --> <p class="postmetadata"> <?php _e(''abgelegt unter''); echo '' ''; the_category('', '') ?> |<?php edit_post_link(__(''-�ndern''),'''','' |<''); ?><?php comments_popup_link(__(''(0) Kommentare »''),__(''1 Kommentar »''), __(''% Kommentare »''), '''',__(''Kommentare nicht möglich'')); ?> </p> <!-- ende div postingtext--> </div> <?php endwhile; ?> <!-- seitennavigation --> <div class="navigation"> <div class="alignleft"><?php next_posts_link(__(''vorige'')) ?></div><div class="alignright"><?php previous_posts_link(__(''n�chste'')) ?></div> </div> <?php else : ?> <!-- wird nichts gefunden, dann suchformular einblenden--> <h2 class="center"><?php _e(''Nichts gefunden''); ?></h2> <p class="center"> <?php include (TEMPLATEPATH . "/searchform.php"); ?> </p> <?php endif; ?> <!-- ende div des postings--> </div> <!-- ende content --> </div> |
Sidebar: Alle Links werden in einer Liste dargestellt und mittels PHP automatisch generiert. Desweiteren bringt man hier auch eigene Dinge wie Werbung etc. unter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <div="sidebar"> <!-- beginn hauptliste --> <ul> <!-- suchformular --> <li id="search"><h2><label for="s">Suche:</label></h2> <?php include (TEMPLATEPATH . ''/searchform.php''); ?></li> <!-- kategorien --><li> <h2><?php _e(''Categories''); ?></h2> <ul><?php wp_list_cats(''sort_column=name&optioncount=1''); ?></ul></li> <!-- archiv --> <li><h2><?php _e(''Archives''); ?></h2> <ul><?php wp_get_archives(''type=monthly''); ?></ul></li> <!-- RSS-Feeds --> <li><h2>RSS</h2> <ul><li><a href="<?php bloginfo(''rss2_url''); ?>">Beiträge (RSS)</a></li> <li><a href="<?php bloginfo(''comments_rss2_url''); ?>">Kommentare (RSS)</a></li> </ul> </li> <!-- statische seiten --> <?php wp_list_pages(''title_li=<h2>'' . __(''Seiten'') . ''</h2>''); ?> <!-- an-/abmeldung + link für adminseite--> <li><h2><?php _e(''Meta''); ?></h2> <ul><?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <?php wp_meta(); ?> </ul> </li> <!-- ende hauptliste --></ul> <!-- ende sidebar --></div> |
Footer:
1 2 3 | <div> <p>© <?php bloginfo(''name''); ?>, powered by <a href="http://wordpress.org/">WordPress</a></p> </div> |
--- ende artikel ---------------------------





kOmMeNtaR sChReIbEn: