Willkommen auf dem Portal für Mediengestalter
|
|
Autor |
Nachricht |
bacon
Dabei seit: 24.10.2007
Ort: -
Alter: -
Geschlecht: -
|
Verfasst So 20.04.2008 23:59
Titel
|
|
|
Ich kenn den mist jetzt nicht. Aber eine echt krude Lösung (da gibts sicher vorgefertigte, die besser sind), wäre bspw.
Code: |
<?php for ($i = 0; have_posts(); $i++ ) : the_post()?>
<?php if ( $i == 0):?>
<!-- hier dein code für den ersten eintrag-->
<div id="post-<?php the_ID(); ?>" class="post">
<p class="date"><?php the_time('F'); ?> <b><?php the_time('j'); ?></b></p>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p class="meta"><small>Posted by <?php the_author(); ?> <?php edit_post_link('Edit', ' | ', ''); ?><br />
Filed under <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments'); ?></small></p>
<div class="entry">
<?php the_excerpt(); ?>
</div>
</div>
<?php else:?>
<!-- hier der für alle andern....-->
<div id="post-<?php the_ID(); ?>" class="post">
<p class="date"><?php the_time('F'); ?> <b><?php the_time('j'); ?></b></p>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p class="meta"><small>Posted by <?php the_author(); ?> <?php edit_post_link('Edit', ' | ', ''); ?><br />
Filed under <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments'); ?></small></p>
<div class="entry">
<?php the_excerpt(); ?>
</div>
</div>
<?endif?>
<?php endfor; ?>
|
syntaxfehler un so darfste behalten
|
|
|
|
|
lue2
Threadersteller
Dabei seit: 13.02.2007
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 21.04.2008 12:17
Titel
|
|
|
hey wow, danke. sieht für mich zeimlich kompliziert aus. weiß jetzt nicht ob ichs falsch eingebaut hab oder ob da n fehler in dem code iss den du mir gegeben hast, auf jeden fall zeigt der bei mir denn gar nix mehr an
kannst du vielleicht noch so nett sein mir zu zeigen wo genau ich das rein zu setzen zu hab?
das hier ist mein code
Code: | <?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="content">
<?php if (have_posts()): ?>
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="post">
<p class="date"><?php the_time('j'); ?> <b><?php the_time('M'); ?></b></p>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p class="meta"><small>Posted by <?php the_author(); ?> <?php edit_post_link('Edit', ' | ', ''); ?><br />
Filed under <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments'); ?></small></p>
<?php $image = get_post_meta($post->ID, 'image_des_beitrags', true); ?>
<a href="<?php the_permalink() ?>"><img class="image_des_beitrags" src="<?php echo $image; ?>" alt="<?php the_title(); ?>" /></a>
<div class="entry">
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Newer Entries') ?></div>
<div class="alignright"><?php next_posts_link('Older Entries »') ?></div>
</div>
<?php else: ?>
<h1 class="pagetitle">Not Found</h1>
<p>Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>
</div>
<!-- end content -->
<?php get_footer(); ?> |
hatte jetzt ab Code: | <?php while (have_posts()) : the_post(); ?> | bis zum 2ten div nach Code: | <?php the_excerpt(); ?> | . hab denn noch ungefähr 100 mal rum probiert, aber irgendwie klappts nicht
|
|
|
|
|
Anzeige
|
|
|
bacon
Dabei seit: 24.10.2007
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 21.04.2008 12:44
Titel
|
|
|
du ersetzt alles inklusive <?php while ... codecodecode ... endwhile?> durch den code, den ich gepostet hab. wenn du glück hast, funzt das sogar
|
|
|
|
|
lue2
Threadersteller
Dabei seit: 13.02.2007
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 21.04.2008 12:58
Titel
|
|
|
ne das klappt so leider nicht bei mir... lustigerweise kam diesmal keine fehlermeldung... . dummerweise wiederholen sich die artiekel nach unten hin ins untendliche
so hier hab ics jetzt eingefugt:
Code: | <?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="content">
<?php if (have_posts()): ?>
<?php while (have_posts()) : the_post(); ?>
<?php for ($i = 0; have_posts(); $i++ ) : the_post()?>
<?php if ( $i == 0):?>
<!-- hier dein code für den ersten eintrag-->
<div id="post-<?php the_ID(); ?>" class="post">
<p class="date"><?php the_time('F'); ?> <b><?php the_time('j'); ?></b></p>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p class="meta"><small>Posted by <?php the_author(); ?> <?php edit_post_link('Edit', ' | ', ''); ?><br />
Filed under <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments'); ?></small></p>
<div class="entry">
<?php the_excerpt(); ?>
</div>
</div>
<?php else:?>
<!-- hier der für alle andern....-->
<div id="post-<?php the_ID(); ?>" class="post">
<p class="date"><?php the_time('F'); ?> <b><?php the_time('j'); ?></b></p>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p class="meta"><small>Posted by <?php the_author(); ?> <?php edit_post_link('Edit', ' | ', ''); ?><br />
Filed under <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments'); ?></small></p>
<div class="entry">
<?php the_excerpt(); ?>
</div>
</div>
<?endif?>
<?php endfor; ?>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Newer Entries') ?></div>
<div class="alignright"><?php next_posts_link('Older Entries »') ?></div>
</div>
<?php else: ?>
<h1 class="pagetitle">Not Found</h1>
<p>Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>
</div>
<!-- end content -->
<?php get_footer(); ?>
|
was mach ich nur falsch??
|
|
|
|
|
tacker
Dabei seit: 22.03.2002
Ort: Trondheim, Norwegen
Alter: 43
Geschlecht:
|
Verfasst Mo 21.04.2008 13:37
Titel
|
|
|
Code: | <?php while (have_posts()) : the_post(); ?>
<?php for ($i = 0; have_posts(); $i++ ) : the_post()?> |
Du hast the_post() zweimal drin.
|
|
|
|
|
bacon
Dabei seit: 24.10.2007
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 21.04.2008 13:38
Titel
|
|
|
wie gesagt, inklusive. While... muss komplett raus, endwhile auch.
http://www.php-faq.de/
|
|
|
|
|
lue2
Threadersteller
Dabei seit: 13.02.2007
Ort: -
Alter: -
Geschlecht: -
|
Verfasst Mo 21.04.2008 13:56
Titel
|
|
|
ahaaa ok supererer, das klappt jetzt ohne fehler und kann auch alles schön anpassen. man freut mich das. liebsten dank!
|
|
|
|
|
|
|
|
Ähnliche Themen |
wordpress - artikel bearbeiten
Wordpress - Artikel erscheint 3 mal auf Startseite
[Wordpress] Neue Artikel mit PHP in SQL-DB importieren
[Suche] Artikel über Logo-Design [solved]
wordpress artikel und kategorie einer seite zuordnen
[wordpress] kategorien unter 2.3 verschieden aussehen lassen
|
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|