mediengestalter.info
FAQ :: Mitgliederliste :: MGi Team

Willkommen auf dem Portal für Mediengestalter

Aktuelles Datum und Uhrzeit: So 28.04.2024 15:42 Benutzername: Passwort: Auto-Login

Thema: [wordpress] ersten artikel anders aussehen lassen [solved] vom 20.04.2008


Neues Thema eröffnen   Neue Antwort erstellen MGi Foren-Übersicht -> Programmierung -> [wordpress] ersten artikel anders aussehen lassen [solved]
Seite: Zurück  1, 2
Autor Nachricht
bacon

Dabei seit: 24.10.2007
Ort: -
Alter: -
Geschlecht: -
Verfasst So 20.04.2008 23:59
Titel

Antworten mit Zitat Zum Seitenanfang

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 *zwinker*
  View user's profile Private Nachricht senden
lue2
Threadersteller

Dabei seit: 13.02.2007
Ort: -
Alter: -
Geschlecht: -
Verfasst Mo 21.04.2008 12:17
Titel

Antworten mit Zitat Zum Seitenanfang

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 *Schnief*
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('&laquo; Newer Entries') ?></div>
         <div class="alignright"><?php next_posts_link('Older Entries &raquo;') ?></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 *Schnief*
  View user's profile Private Nachricht senden
Anzeige
Anzeige
bacon

Dabei seit: 24.10.2007
Ort: -
Alter: -
Geschlecht: -
Verfasst Mo 21.04.2008 12:44
Titel

Antworten mit Zitat Zum Seitenanfang

du ersetzt alles inklusive <?php while ... codecodecode ... endwhile?> durch den code, den ich gepostet hab. wenn du glück hast, funzt das sogar *zwinker*
  View user's profile Private Nachricht senden
lue2
Threadersteller

Dabei seit: 13.02.2007
Ort: -
Alter: -
Geschlecht: -
Verfasst Mo 21.04.2008 12:58
Titel

Antworten mit Zitat Zum Seitenanfang

ne das klappt so leider nicht bei mir... lustigerweise kam diesmal keine fehlermeldung... Grins . dummerweise wiederholen sich die artiekel nach unten hin ins untendliche *Schnief*
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('&laquo; Newer Entries') ?></div>
         <div class="alignright"><?php next_posts_link('Older Entries &raquo;') ?></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?? *Schnief*
  View user's profile Private Nachricht senden
tacker

Dabei seit: 22.03.2002
Ort: Trondheim, Norwegen
Alter: 43
Geschlecht: Männlich
Verfasst Mo 21.04.2008 13:37
Titel

Antworten mit Zitat Zum Seitenanfang

Code:
 <?php while (have_posts()) : the_post(); ?>

         <?php for ($i = 0; have_posts(); $i++ ) : the_post()?>

Du hast the_post() zweimal drin.
  View user's profile Private Nachricht senden Website dieses Benutzers besuchen
bacon

Dabei seit: 24.10.2007
Ort: -
Alter: -
Geschlecht: -
Verfasst Mo 21.04.2008 13:38
Titel

Antworten mit Zitat Zum Seitenanfang

wie gesagt, inklusive. While... muss komplett raus, endwhile auch.

http://www.php-faq.de/
  View user's profile Private Nachricht senden
lue2
Threadersteller

Dabei seit: 13.02.2007
Ort: -
Alter: -
Geschlecht: -
Verfasst Mo 21.04.2008 13:56
Titel

Antworten mit Zitat Zum Seitenanfang

ahaaa ok supererer, das klappt jetzt ohne fehler und kann auch alles schön anpassen. man freut mich das. liebsten dank! Grins
  View user's profile Private Nachricht senden
 
Ä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
Neues Thema eröffnen   Neue Antwort erstellen Seite: Zurück  1, 2
MGi Foren-Übersicht -> Programmierung


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.