hallo leutz.
kann mir jemand helfen?
ich hätte gern nur eine kategorie als erste angezeigte seite auf meinem blogg.
wie kann ich das realisieren?
nur eine kategorie als "mainpage"?!
-
-
- Gerade eben
- Anzeige
Hallo!
Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.
- ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
- ✔️ Deutsche Server & DSGVO-konform
- ✔️ Persönlicher Support (kein 0815-Ticket-System)
-
Hi also du möchtest die Beiträge einer Kat als erster auf der Startseite und sonst keine anderen
sagen wir diese Kategorie hat die ID 5PHP<?php query_posts('cat=5'); if(have_posts()) : while(have_posts()) : the_post() ?> dann das ganze andere ... bis zu <php endwhile; endif; ?>wenn du damit was anfangen kannst gut, wenn nicht musst du die index.php Deines Themes hier posten oder das Template der Seite, die Du als Startseite definiert hast
lg
-
ersteinmal vielen dank monika.
so geht es aber leider nicht ;o(
also um ganz ehrlich zu sein, weiß ich nicht mal wie man eine seite als startseite definiert. aber hier erstmal meine index.php ...PHP
Alles anzeigen<?php get_header(); ?> <div id="content_main"> <table border="0" cellpadding="0" cellspacing="0" width="519"> <tbody><tr><td> <table class="blog" cellpadding="0" cellspacing="0"> <tbody><tr><td valign="top"> <div> <table class="contentpaneopen"> <tbody> <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?> <tr><td class="contentheading" width="100%"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> </td></tr> <tr><td> <span class="small"><?php the_time('F jS, Y') ?> under <?php the_category(', ') ?>. [ <a href="<?php comments_link(); ?>"><strong>Comments:</strong> <?php comments_number('none','1','%'); ?></a> ] <?php edit_post_link('Edit',' [ ',' ] '); ?></span></td></tr> <tr> <td width="100%"> <p> <?php the_content('Read more »'); ?></p> <hr size="1" color="#666666"> </td> </tr> <?php endwhile; ?> <tr> <td> <p><?php next_posts_link('« Previous entries') ?> <?php previous_posts_link('Next entries »') ?> </p> </td> </tr> <?php else : ?> <tr> <td> <h2>Not found!</h2> <p>Could not find the requested page. Use the navigation menu to find your target, or use the search box below:</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> </td></tr> <?php endif; ?> </tbody></table> </div> </td></tr></tbody></table> </td></tr></tbody></table> </div> <!-- end main body --> </div></div> <?php get_sidebar(); ?> <?php get_footer(); ?>
wie hasst du das mit dem code gemacht?
zu meiner entschuldigung. ich habe mich lange nicht mit wordpress beschäftigt, hatte eine lange zeit eine gut laufende wp 1.5 version bis mein serveradmin umgezogen ist und gleich 2.0 installiert hatte.
dann musste ich notgedrungen und schnell umbasteln.
habe dazu das template tiju-13 genommen.
jetzt bin ich gerade dabei mich mal wieder einzufuchsen.
danke noch mal und bis bald ... -
PHP
Alles anzeigen<?php get_header(); ?> <div id="content_main"> <table border="0" cellpadding="0" cellspacing="0" width="519"> <tbody><tr><td> <table class="blog" cellpadding="0" cellspacing="0"> <tbody><tr><td valign="top"> <div> <table class="contentpaneopen"> <tbody> <?php if (have_posts()) : ?> <?php query_posts('cat=5'); <?php while (have_posts()) : the_post(); ?> <tr><td class="contentheading" width="100%"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> </td></tr> <tr><td> <span class="small"><?php the_time('F jS, Y') ?> under <?php the_category(', ') ?>. [ <a href="<?php comments_link(); ?>"><strong>Comments:</strong> <?php comments_number('none','1','%'); ?></a> ] <?php edit_post_link('Edit',' [ ',' ] '); ?></span></td></tr> <tr> <td width="100%"> <p> <?php the_content('Read more »'); ?></p> <hr size="1" color="#666666"> </td> </tr> <php endwhile; endif; ?> <tr> <td> <p><?php next_posts_link('« Previous entries') ?> <?php previous_posts_link('Next entries »') ?> </p> </td> </tr> <?php else : ?> <tr> <td> <h2>Not found!</h2> <p>Could not find the requested page. Use the navigation menu to find your target, or use the search box below:</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> </td></tr> <?php endif; ?> </tbody></table> </div> </td></tr></tbody></table> </td></tr></tbody></table> </div> <!-- end main body --> </div></div> <?php get_sidebar(); ?> <?php get_footer(); ?>
könnte so gehen -
hallo monika
klappt leider auch nicht wenn ich ...
<?php if (have_posts()) : ?>
<?php query_posts('cat=5');
<?php while (have_posts()) : the_post(); ?>gegen
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
(und mehr ist es ja nicht oder?)
dann bekomme ich fogenden fehler ...
Parse error: syntax error, unexpected '<' in /home/396/domains/helmke.org/html/wp-content/themes/tiju-13/index.php on line 35
gleich beim aufruf der seite ;o(
hmmmzzzzzzz ...
-
weiß noch wer was?
-
PHP
Alles anzeigen<?php $posts = get_posts('numberposts=3&category=1'); foreach($posts as $post) : setup_postdata($post); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('j. F Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('<p class="serif"><strong>Weiterlesen »</strong></p>'); ?> <?php link_pages('<p><strong>Seiten:</strong> ', '</p>', 'number'); ?> </div> <p class="postmetadata">Abgelegt unter <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Bearbeiten','','<strong>|</strong>'); ?> Autor: <?php the_author_posts_link(); ?></p> </div> <?php endforeach; ?>Keine Ahnung ob der Schnipsel so reicht. Hier meine ganze home.php:
PHP
Alles anzeigen<?php get_header(); ?> <div id="content" class="narrowcolumn"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2>Willkommen</h2> <div class="entry"> <?php the_content('<p class="serif"><strong>Weiterlesen »</strong></p>'); ?> <?php link_pages('<p><strong>Seiten:</strong> ', '</p>', 'number'); ?> </div> <br></br> <p class="trenner alt">Aktuelles</p> <?php $posts = get_posts('numberposts=3&category=1'); foreach($posts as $post) : setup_postdata($post); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('j. F Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('<p class="serif"><strong>Weiterlesen »</strong></p>'); ?> <?php link_pages('<p><strong>Seiten:</strong> ', '</p>', 'number'); ?> </div> <p class="postmetadata">Abgelegt unter <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Bearbeiten','','<strong>|</strong>'); ?> Autor: <?php the_author_posts_link(); ?></p> </div> <?php endforeach; ?> </div> <?php endwhile; ?> <?php else : ?> <!--<h2 class="center">Nichts gefunden</h2> <p class="center">Du hast nach etwas gesucht, das es hier nicht gibt.</p>--> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!