Kommentar ID stimmt nicht - Wer hilft?

  • Hallo,

    bei mir stimmt etwas mit den Kommentar IDs nicht (schon länger, aber ich will jetzt endlich dem entgegenwirken ;))

    Schaut es euch mal hier in der "Live" Version an: Problematik der Zulässigkeit einer Verlinkung auf offensichtlich rechtswidrige URLs | IT-Recht Blog

    Wie ihr seht, sind dort die Kommentare 186 und 187 zu sehen. Ich will aber, dass diese Kommentare sich nur auf den Artikel beziehen, und somit 1 und 2 heißen.

    Im Code schauts so aus:

    PHP
    <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
                <strong><a href="#comment-<?php comment_ID() ?>" title="">#<?php comment_ID() ?></a></strong> | 
    <?php comment_author_link() ?> <?php _e('sagt:','simpla'); ?>
                <?php if ($comment->comment_approved == '0') : ?>
                <em><?php _e('Your comment is awaiting moderation.','simpla'); ?></em>
                <?php endif; ?>
                <br />


    Kann jemand helfen?

    Viele Grüße,
    eha


    Einmal editiert, zuletzt von eha (23. September 2008 um 15:09)

    • 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)

    Mehr erfahren

  • PHP
    <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
                <strong><a href="#comment-<?php comment_ID() ?>" title="">#[COLOR="Red"]<?php comment_ID() ?>[/COLOR]</a></strong> | 
    <?php comment_author_link() ?> <?php _e('sagt:','simpla'); ?>
                <?php if ($comment->comment_approved == '0') : ?>
                <em><?php _e('Your comment is awaiting moderation.','simpla'); ?></em>
                <?php endif; ?>
                <br />


    An der rot markierten Stelle muss du einen selbstdefinierten Zähler ausgeben. Dieser wird vor dem Kommentarloop mit 1 initialisiert und am Ende des Kommentarloops jeweils inkrementiert.

  • PHP
    <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
                <strong><a href="#comment-<?php comment_ID() ?>" title="">#[COLOR=Red]<?php comment_ID() ?>[/COLOR]</a></strong> | 
    <?php comment_author_link() ?> <?php _e('sagt:','simpla'); ?>
                <?php if ($comment->comment_approved == '0') : ?>
                <em><?php _e('Your comment is awaiting moderation.','simpla'); ?></em>
                <?php endif; ?>
                <br />

    An der rot markierten Stelle muss du einen selbstdefinierten Zähler ausgeben. Dieser wird vor dem Kommentarloop mit 1 initialisiert und am Ende des Kommentarloops jeweils inkrementiert.


    urghs... einfach gesagt: zwischen die Klammern ne 1 schreiben? ;)


  • Na nicht ganz. Such mal die Zeile

    PHP
    <?php foreach ( $comments as $comment ) : ?>

    und schreib davor mal:

    PHP
    <?php $comments_counter = 1; ?>


    An die rot markierte Stelle kommt:

    PHP
    <?php echo $comments_counter ?>


    und vor das schließende

    PHP
    <?php endforeach; ?>

    noch ein

    PHP
    <?php $comments_counter++; ?>

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!