Plugin "Pagebar2" in comments.php integrieren

  • Hallo,

    habe bei mir das Theme "German Newspaper" installiert. Da ich viel Kommentare pro Seite habe, möchte ich das Plugin "Pagebar2" in die comments.php integrieren. Habe es versucht aber es klappt irgendwie nicht. Die richtige Datei ist doch die comments.php oder?

    Meine URL hier!

    Kann jemand helfen? Vielen Dank im voraus!

    Hier meine comments.php, darunter den Codeschnipsel, den man laut elektroelch (Pagebar Plugin-Entwickler) einbauen muss.

    <?php

    // Do not delete these lines
    if ( isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']) )
    die ('Please do not load this page directly. Thanks!');

    if ( !empty($post->post_password) )
    { // if there's a password
    if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password )
    { // and it doesn't match the cookie
    echo ' <p class="nocomments">' . __('This post is password protected. Enter the password to view comments.', 'german_newspaper') . '</p>' . "\n";

    return;
    }
    }

    /* This variable is for alternating comment background */
    $oddcomment = 'class="alt" ';


    // <!-- You can start editing here. -->


    if ( $comments )


    {
    echo ' <h3 id="comments">';
    comments_number(__('No Responses', 'german_newspaper'), __('One Response', 'german_newspaper'), __('% Responses', 'german_newspaper'));
    echo ' ';
    printf(__('to “%s”', 'german_newspaper'), the_title('', '', false));
    echo ' </h3>' . "\n\n";
    echo ' <ol class="commentlist">' . "\n";

    foreach ( $comments as $comment )
    {
    echo ' <li ' . $oddcomment . 'id="comment-' . get_comment_ID() . '">' . get_avatar( $comment, 32 ) . "\n";
    printf(__('<cite>%s</cite> Says:', 'german_newspaper'), get_comment_author_link());


    if ( $comment->comment_approved == '0' )
    {
    echo ' <em>' . __('Your comment is awaiting moderation.', 'german_newspaper') . '</em>' . "\n";
    }

    echo ' <br />' . "\n";
    echo ' <small class="commentmetadata"><a href="#comment-' . get_comment_ID() . '" title="">';
    printf(__('%1$s at %2$s', 'german_newspaper'), get_comment_date(__('F jS, Y', 'german_newspaper')), get_comment_time());
    echo '</a> ';
    edit_comment_link(__('edit', 'german_newspaper'),'&nbsp;&nbsp;','');
    echo '</small>' . "\n\n\n";

    comment_text();

    echo "\n\n\n" . ' </li>' . "\n";



    /* Changes every other comment to a different class */
    $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';

    }

    echo '</ol>' . "\n\n";


    }


    else
    {
    // this is displayed if there are no comments so far

    if ( 'open' == $post->comment_status )
    {
    // <!-- If comments are open, but there are no comments. -->
    }
    else
    {
    // comments are closed
    // <!-- If comments are closed. -->
    echo ' <p class="nocomments">' . __('Comments are closed.', 'german_newspaper') . '</p>' . "\n";
    }
    }


    if ( 'open' == $post->comment_status )
    {
    echo ' <h3 id="respond">' . __('Leave a Reply', 'german_newspaper') . '</h3>' . "\n";

    if ( get_option('comment_registration') && !$user_ID )
    {
    echo ' <p>';
    printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'german_newspaper'), get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode(get_permalink()));
    echo ' </p>' . "\n";
    }
    else
    {
    echo ' <form action="' . get_option('siteurl') . '/wp-comments-post.php" method="post" id="commentform">' . "\n";

    if ( $user_ID )
    {
    echo ' <p>';
    printf(__('Logged in as <a href="%1$s">%2$s</a>.', 'german_newspaper'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity);
    echo ' <a href="' . get_option('siteurl') . '/wp-login.php?action=logout" title="' . __('Log out of this account', 'german_newspaper') . '">' . __('Log out &raquo;', 'german_newspaper') . '</a></p>' . "\n";
    }
    else
    {
    echo '<p><input type="text" name="author" id="author" value="' . $comment_author . '" size="22" tabindex="1" />' . "\n";
    echo '<label for="author"><small>' . __('Name', 'german_newspaper') . ' ';

    if ( $req ) _e("(required)", "german_newspaper");

    echo '</small></label></p>' . "\n";
    echo '<p><input type="text" name="email" id="email" value="' . $comment_author_email . '" size="22" tabindex="2" />' . "\n";
    echo '<label for="email"><small>' . __('Mail (will not be published)', 'german_newspaper') . ' ';
    if ($req) _e("(required)", "german_newspaper");

    echo '</small></label></p>' . "\n";
    echo '<p><input type="text" name="url" id="url" value="' . $comment_author_url . '" size="22" tabindex="3" />' . "\n";
    echo '<label for="url"><small>' . __('Website', 'german_newspaper') . '</small></label></p>' . "\n";
    }

    echo '<!--<p><small>';
    printf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>', 'german_newspaper'), allowed_tags());
    echo '</small></p>-->' . "\n";
    echo '<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>' . "\n";
    echo '<p><input name="submit" type="submit" id="comment_submit" tabindex="5" value="' . __('Submit Comment', 'german_newspaper') . '" />' . "\n";
    echo '<input type="hidden" name="comment_post_ID" value="' . $id . '" />' . "\n";
    echo '</p>' . "\n";

    do_action('comment_form', $post->ID);

    echo '</form>' . "\n\n";

    }



    // If registration required and not logged in
    }


    ?>


    Hier der Codeschnipsel:

    if (function_exists('commentbar')) commentbar();

    Mal biste der Baum, mal biste der Hund!

    • 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

  • Hy, in der readme wirsd es wie folgt beschrieben, wie man sieht habe ich aber den div nicht und ich komme nicht klar was löschen und dann wohin?!

    Aus der readme:

    * Adding pagebar to your paged comments
    This pagebar can not be added automatically (there is no action indicating the end of the comment loop) so you have to edit the file "comments.php". If your theme contains the standard navigation for paged comments you first have to delete the following code:

    <div class="navigation">
    <div class="alignleft"><?php previous_comments_link() ?></div>
    <div class="alignright"><?php next_comments_link() ?></div>
    </div>

    (The code does not have to look necessarily exactly the same, this example is from the WordPress default theme.) Then you can add the commentbar to your pages:

    `if (function_exists('commentbar'))
    commentbar();`

    Mal biste der Baum, mal biste der Hund!

Jetzt mitmachen!

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