zoukankan      html  css  js  c++  java
  • wordpres 自定义comment样式

    http://wange.im/diy-wordpress-comment-style.html

    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
    
        <article>
    <div class="cell hoverable reply" id="comment-<?php comment_ID(); ?>">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tbody><tr>
    <td valign="top" width="48">
    <a href="http://forum.tianming.me/index.php/user/info/2" class="profile_link" title="hurner">
    <img alt="hurner medium avatar" class="medium_avatar" src="http://forum.tianming.me/uploads/avatar/default.jpg">
    </a>
    </td>
    <td width="10"></td>
    <td valign="top" width="auto">
    <div class="fr">
    <small class="snow">
    #3 -
    4 天前
    <a href="#reply" onclick="replyOne('hurner');"><img align="absmiddle" alt="Reply_button" border="0" id="mention_button" class="clickable mention_button" data-mention="hurner" src="http://forum.tianming.me/static/images/reply_button.png"></a>
    <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    </small>
    </div>
    <a href="http://forum.tianming.me/index.php/user/info/2" class="dark startbbs profile_link" title="hurner">hurner</a>
    <span class="snow">&nbsp;&nbsp; 
    <div class="sep5"></div>
    <div class="content reply_content"><?php comment_text() ?></div>
    
    </span></td>
    </tr>
    </tbody></table>
    </div>
    </article>
    
    
    <?php
            }

    如下调用:

                    <?php
                    //Gather comments for a specific page/post 
                    $comments = get_comments(array(
                        'post_id' => $post->ID,
                        'status' => 'approve' //Change this to the type of comments to be displayed
                        ));
    
                    //Display the list of comments
                    wp_list_comments(array(
                        'per_page' => 10, //Allow comment pagination
                        'reverse_top_level' => false, //Show the latest comments at the top of the list
                        'callback'=> 'mytheme_comment',
                        ), $comments);
                    ?>

    原始的评论输入框,如下comment_reply_link使用:

    		<div class="commen-form">
    			<?php 
    			$args = array(
    				'id_form' => 'commentform',
    				);
    			comment_form($args);
    			?>
    		</div>
    		
    

      

  • 相关阅读:
    求自变量的取值范围时需要注意的角度
    求正弦型函数的解析式
    求三角形面积的最值[范围]
    三角函数对称性[奇偶性]
    2019届高三理科数学选择填空整理
    均值不等式使用变化
    破解正弦型函数参数的取值范围
    构造法求数列通项公式
    累乘法
    Centos中压缩(zip)和解压(unzip)命令
  • 原文地址:https://www.cnblogs.com/hurner/p/3155116.html
Copyright © 2011-2022 走看看