wp-postratings - Comment-Code: Wohin?
-
-
- 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)
-
Wie sieht denn deine comments.php aus, und wo möchtest du das Rating gerne haben?
-
Wie sieht denn deine comments.php aus, und wo möchtest du das Rating gerne haben?
hier ist ein Beispiel:
Salsa | Top100 Music Charts » C-SALSA.COMDas Rating will ich genau am Anfang der jeweils nächsten Zeile nach jedem Comment haben.
Das hier ist die comment.php:
PHP
Alles anzeigen<?php // Do not delete these lines if ('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 ?> <p class="nocomments">This post is password protected. Enter the password to view comments.<p> <?php return; } } /* This variable is for alternating comment background */ $oddcomment = 'alt'; ?> <!-- You can start editing here. --> <?php if ($comments) : ?> <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> <ol class="commentlist"> <?php foreach ($comments as $comment) : ?> <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>"> <cite><?php comment_author_link() ?></cite> Says: <?php if ($comment->comment_approved == '0') : ?> <em>Your comment is awaiting moderation.</em> <?php endif; ?> <br /> <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small> <?php comment_text() ?> </li> <?php /* Changes every other comment to a different class */ if ('alt' == $oddcomment) $oddcomment = ''; else $oddcomment = 'alt'; ?> <?php endforeach; /* end for each comment */ ?> </ol> <?php else : // this is displayed if there are no comments so far ?> <?php if ('open' == $post->comment_status) : ?> <!-- If comments are open, but there are no comments. --> <?php else : // comments are closed ?> <!-- If comments are closed. --> <p class="nocomments">Comments are closed.</p> <?php endif; ?> <?php endif; ?> <?php if ('open' == $post->comment_status) : ?> <h3 id="respond">Leave a Reply</h3> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p> <?php else : ?> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout »</a></p> <?php else : ?> <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> <label for="author"><strong>Name</strong> <?php if ($req) echo "(required)"; ?></label></p> <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> <label for="email"><strong>Mail</strong> (will not be published) <?php if ($req) echo "(required)"; ?></label></p> <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><strong>Website</strong></label></p> <?php endif; ?> <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p> <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> </p> <?php do_action('comment_form', $post->ID); ?> </form> <?php endif; // If registration required and not logged in ?> <?php endif; // if you delete this the sky will fall on your head ?>Wohin muss der Code-Schnipsel, um das Ranking einzufügen?
-
Also nach dem eigentlichen Kommentartext? Dann so:
PHP
Alles anzeigen<?php // Do not delete these lines if ('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 ?> <p class="nocomments">This post is password protected. Enter the password to view comments.<p> <?php return; } } /* This variable is for alternating comment background */ $oddcomment = 'alt'; ?> <!-- You can start editing here. --> <?php if ($comments) : ?> <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> <ol class="commentlist"> <?php foreach ($comments as $comment) : ?> <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>"> <cite><?php comment_author_link() ?></cite> Says: <?php if ($comment->comment_approved == '0') : ?> <em>Your comment is awaiting moderation.</em> <?php endif; ?> <br /> <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small> <?php comment_text() ?> [COLOR="Red"]<?php comment_author_ratings(); ?>[/COLOR] </li> <?php /* Changes every other comment to a different class */ if ('alt' == $oddcomment) $oddcomment = ''; else $oddcomment = 'alt'; ?> <?php endforeach; /* end for each comment */ ?> </ol> <?php else : // this is displayed if there are no comments so far ?> <?php if ('open' == $post->comment_status) : ?> <!-- If comments are open, but there are no comments. --> <?php else : // comments are closed ?> <!-- If comments are closed. --> <p class="nocomments">Comments are closed.</p> <?php endif; ?> <?php endif; ?> <?php if ('open' == $post->comment_status) : ?> <h3 id="respond">Leave a Reply</h3> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p> <?php else : ?> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout »</a></p> <?php else : ?> <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> <label for="author"><strong>Name</strong> <?php if ($req) echo "(required)"; ?></label></p> <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> <label for="email"><strong>Mail</strong> (will not be published) <?php if ($req) echo "(required)"; ?></label></p> <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /> <label for="url"><strong>Website</strong></label></p> <?php endif; ?> <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p> <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> </p> <?php do_action('comment_form', $post->ID); ?> </form> <?php endif; // If registration required and not logged in ?> <?php endif; // if you delete this the sky will fall on your head ?>
Eventuell noch in ein <p>- oder <div>-Element eingeschlossen, damit es auch wirklich auf die nächste Zeile kommt. -
Hi, ich greif das mal auf.
Ich habe gehofft das mit dieser Funktion ein User beim kommentieren auch gleich sein Ranting abgeben kann.
Leider scheint das nicht so zu sein.
Gibt es eine Möglichkeit die "rating"-Funktion so auf der Comment-Site zu platzieren das man sie wiee in der Artikelübersicht verwenden kann?
Ich hoffe ich habe mich einigermaßen nachvollziehbar ausgedrückt.
-
Wenn ich dich richtig verstehe... bau den Code zusätzlich zur index.php auch in die single.php ein.
-
P E R F E K T !! :-D
Gut wenn man jemand kennt der weis wo es steht .... ;)
-
bei mir funzt das nicht
Also der code
[COLOR=Red]<?php comment_author_ratings(); ?>[/COLOR]
muss in Kommentare (comments.php) im Adminbereich unter Design unter Theme-Editor ?PHP
Alles anzeigen<?php // Do not delete these lines if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('So nicht!'); 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 ?> <p class="nocomments"><?php _e("Dieser Beitrag ist Passwortgesch�tzt, gib das Passwort ein um die Kommentare zu lesen!"); ?><p> <?php return; } } /* This variable is for alternating comment background */ $oddcomment = "alt"; /* This variable is for the depiction of comment numbers */ $commentNO = 0; ?> <div id="comments"> <?php if ($comments) : ?> <?php comment_author_ratings(); ?> <h3 id="comments"><?php comments_number('Keine Kommentare', 'Ein Kommentar', '% Kommentare' );?></h3> <?php foreach ($comments as $comment) : ?> <?php $commentNO++; ?> <div id="comment-<?php comment_ID() ?>" class="comment"> <? if (function_exists('gravatar')) { if ('' != get_comment_author_url()) { echo "<a href='$comment->comment_author_url' title='Besuche $comment->comment_author'>"; } else { echo "<a href='http://www.gravatar.com' title='Speichere Deinen eigenen Gravatar auf gravatar.com!'>"; } echo "<img src='"; if ('' == $comment->comment_type) { echo gravatar($comment->comment_author_email); } elseif ( ('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type) ) { echo gravatar($comment->comment_author_url); } echo "' alt='' class='gravatar' /></a>"; } ?> <h4><a href="#comment-<?php comment_ID() ?>" class="commentnumber" title="Permanenter Link zu Kommentar <?php comment_ID() ?>"><?php echo $commentNO; ?>.</a> <img src="<?php echo bloginfo('template_url'); ?>/images/user_comment.png" class="contentimage" /> <?php comment_author_link() ?> schrieb am <?php comment_date('d. F Y') ?> um <?php comment_time() ?></dt></h4> <p><?php comment_text() ?></p> </div> <?php endforeach; /* end for each comment */ ?> <?php else : // this is displayed if there are no comments so far ?> <?php if ('open' == $post->comment_status) : ?> <!-- If comments are open, but there are no comments. --> <h1>Noch keine Kommentare!</h1> <?php else : // comments are closed ?> <!-- If comments are closed. --> <h1>Kommentare deaktiviert!</h1> <?php endif; ?> <?php endif; ?> </div> <?php if ('open' == $post-> comment_status) : ?> <div id="commentform"> <a name="postcomment"></a><h1>Schreibe einen Kommentar</h1> <form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>" /> <?php if ($user_ID) : ?> <p>Eingeloggt als: <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>">Logout »</a></p> <?php else : ?> <p> <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="35" tabindex="1" class="text" /> <label for="author">Name</label> </p> <p> <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="35" tabindex="2" class="text" /> <label for="email">E-Mail (wird nicht angezeigt)</label> </p> <p> <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="35" tabindex="3" class="text" /> <label for="url">Website</label> </p> <?php endif; ?> <?php comment_author_ratings(); ?> <p class="commentforminfo">Folgende Tags sind erlaubt: <?php echo allowed_tags(); ?></p> <p><textarea name="comment" id="comment" cols="60" rows="10" tabindex="4" class="text"></textarea></p> <p><input name="submit" type="submit" id="submit" tabindex="5" value="Kommentar schreiben" class="text" /></p> <?php do_action('comment_form', $post->ID); ?> </form> </div> <?php endif; ?>???
zeigt aber nichts an
-
Hi, ich hoffe ich verstehe das nun richtig.
Du muss den Code in die Single.php einbinden. dann funzt es
-
die sieht bei mir so aus und wo da genau habs ja drin zeigt aber nichts an
PHP
Alles anzeigen<?php include "header.php"; ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_date('d. F Y', '<h1 class="date">', '</h1>') ?> <?php $post = $wp_query->post; ?> <div class="entry"> <h1><?php the_title(); ?></h1> <div class="entrycontent"> <?php the_content('Kompletten Beitrag lesen ...'); ?> </div> <div class="entryfooter"> von <img src="<?php echo bloginfo('template_url'); ?>/images/user.png" class="contentimage" /> <a href="<?php the_author_url(); ?>"><?php the_author() ?></a> | <img src="<?php echo bloginfo('template_url'); ?>/images/folder_page.png" class="contentimage" /> <?php the_category(', '); ?> | <a href="<?php trackback_url(display); ?>"><img src="<?php echo bloginfo('template_url'); ?>/images/database_save.png" class="contentimage" /> Trackback</a> | <a href="<?php bloginfo_rss('comments_rss2_url'); ?>"><img src="<?php echo bloginfo('template_url'); ?>/images/rss.png" class="contentimage" /> RSS Feed</a> </div> </div> <?php comments_template(); ?> <?php endwhile; else: ?> <div class="entry"> <h1>Nichts gefunden!</h1> <div class="entrycontent"> <?php _e("Es wurden keine Eintr�ge gefunden!"); ?> </div> </div> <?php comment_author_ratings(); ?> <?php endif; ?> <?php include "sidebar.php"; ?> -
Also der code
[COLOR=Red]<?php comment_author_ratings(); ?>[/COLOR]
muss in Kommentare (comments.php) im Adminbereich unter Design unter Theme-Editor ?Du schreibst doch das Du die comments.php angepasst hast!? Ich meine aber die single.php
-
meine Single.php sieht so aus
PHP
Alles anzeigen<?php include "header.php"; ?> <?php comment_author_ratings(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_date('d. F Y', '<h1 class="date">', '</h1>') ?> <?php $post = $wp_query->post; ?> <div class="entry"> <h1><?php the_title(); ?></h1> <div class="entrycontent"> <?php the_content('Kompletten Beitrag lesen ...'); ?> </div> <div class="entryfooter"> von <img src="<?php echo bloginfo('template_url'); ?>/images/user.png" class="contentimage" /> <a href="<?php the_author_url(); ?>"><?php the_author() ?></a> | <img src="<?php echo bloginfo('template_url'); ?>/images/folder_page.png" class="contentimage" /> <?php the_category(', '); ?> | <a href="<?php trackback_url(display); ?>"><img src="<?php echo bloginfo('template_url'); ?>/images/database_save.png" class="contentimage" /> Trackback</a> | <a href="<?php bloginfo_rss('comments_rss2_url'); ?>"><img src="<?php echo bloginfo('template_url'); ?>/images/rss.png" class="contentimage" /> RSS Feed</a> </div> </div> <?php comments_template(); ?> <?php endwhile; else: ?> <div class="entry"> <h1>Nichts gefunden!</h1> <div class="entrycontent"> <?php _e("Es wurden keine Eintr�ge gefunden!"); ?> </div> </div> <?php endif; ?> <?php include "sidebar.php"; ?>aber ich weiß halt nicht wohin mit dem code ...bekomme einfach nichts angezeit. Danke
-
-
super die Sterne sind jetzt da ...allerdings erst auf der Seite wo man den Kommentar ablasen kann. Geht es auch gleich auf der Artikelseite? Und wie sieht es eigentlich aus, kann man das auch für Bilder nutzen ich habe NextGEN Galerie drauf
-
Jepp, das gleich in die ... Upps ... page.php??
Ich glaube ja, kann aber bis morgen nicht nachschaun.Aber ich meine schon ;-)
-
das wäre lieb von dir....danke ...eilt ja auch nicht
-
-
hmmm...also nirgends wo ich gern hätte. Diesen teil gibts nur in den 2 php's.
Muss doch irgendwie gehen mit den bildern .... -
Das Problem mit den Bildern habe ich nun so gelöst:
die User sollen ehh Ihre Bilder in die Galery laden und dann können sie unter der Kategorie Hot or Not einfach ein Post mit Ihrem Bild veröffentlichen und schon kann es bewertet werden !
Nicht ganz so wie ich wollte aber naja.Ich habe schon gesehen das Leute wie eine Art Topliste haben. wie kann ch diese auf einer extra Seite ausgeben lassen?
-
hallo und danke genau den php code hatte ich auch gesucht.
(<?php if(function_exists('the_ratings')) { the_ratings(); } ?>)Ist der code denn kemplett?? den laut sreen vom ersteller ist dort mehr als nur die sterne.
MFG
-
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!