WordPress wp_enqueue_script( ‘comment-reply’ ) für benutzerdefiniertes Design

Lesezeit: 2 Minuten

Wordpress wp enqueue script comment reply fur benutzerdefiniertes Design
classicjonesynz

Ich habe das verfolgt Lernprogramm und ich schaffe es nicht, dass meine Antwort mit dem wie beabsichtigt funktioniert wp_enqueue_script( 'comment-reply' ); php-Funktion.

Ich habe Code entfernt, der meiner Meinung nach für das, was ich erreichen möchte, irrelevant ist.

Erwartete Ausgabe (entnommen aus Twenty Eleven 1.3 Ohne Stylesheets)

Erwartete Ausgabe
(Quelle: iforce.co.nz)

Tatsächliche Ausgabe (aus meinem Thema entnommen Ohne Stylesheets)

Tatsächliche Ausgabe
(Quelle: iforce.co.nz)

Wie kann ich das bewerkstelligen Erwartete Ausgabe davon ausgehend Lernprogramm für erweiterte Kommentare? und was soll ich mit meiner functions.php und single.php tun, um dies zu erreichen?

Wordpress wp enqueue script comment reply fur benutzerdefiniertes Design
classicjonesynz

Die Lösung ist eigentlich ziemlich einfach … nach ein wenig Lesen des WordPress-Codes für das Javascript. Ich fand das Problem darin, wie jeder Kommentarblock erstellt wurde.

basierend auf dieser Funktion in function.php

//this function will be called in the next section
function advanced_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; 
$PostAuthor = false;
if($comment->comment_author_email == get_the_author_email()) {
$PostAuthor = true;}
elseif($comment->comment_author_email == '[email protected]') {
$PostAuthor = true;} ?>
<li <?php if($PostAuthor) {echo "class="authorcomment" ";} ?>
<?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div class="comment-author vcard">
<?php echo get_avatar($comment, $size="48",$default="<path_to_url>" ); ?>
<div class="comment-meta"<a href="https://stackoverflow.com/questions/10991336/<?php%20the_author_meta("user_url'); ?>"><?php printf(__('%s'), get_comment_author_link()) ?></a></div>
<small><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?></small>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<div id="moderation"><?php _e('Your comment is awaiting moderation.') ?></div>
          <?php endif; ?><br />
        <div class="comment-text">  
          <?php comment_text() ?>
        </div>
          <div class="reply">
             <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])), $comment->comment_ID) ?>
             <?php delete_comment_link(get_comment_ID()); ?>
          </div>
  <div class="clear"></div>
      <?php } ?>

Ich fand den Fehler war mit

<?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">

Indem Sie einfach das “li-” in der ID entfernen, sodass es id=”comment-” bildet

Das Antwortformular bewegt sich jetzt auf Antwort.

  • Das ist es: Durch einfaches Entfernen des “li-” in der ID, so dass es id=”comment-” bildet

    – Banago

    20. Mai 2014 um 9:06 Uhr

998550cookie-checkWordPress wp_enqueue_script( ‘comment-reply’ ) für benutzerdefiniertes Design

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy