مرسی امین جان مشکل حل شد ...:گل::نیش:
خواهش میکنم :احترام:
:گل:
مرسی امین جان مشکل حل شد ...:گل::نیش:
wp_list_comments(array('callback' => 'twentyten_comment'));
function twentyten_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author vcard">
<?php echo get_avatar( $comment, 40 ); ?>
<?php printf( __( '%s <span class="says"></span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?> | <?php printf(__(' %1$s '), get_comment_date()) ?>
<br />
</div><!-- .comment-author .vcard -->
<?php if ( $comment->comment_approved == '0' ) : ?>
<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
<?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );?>
</div><!-- .comment-meta .commentmetadata -->
<div class="comment-body"><?php comment_text(); ?></div>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div><!-- .reply -->
</div><!-- #comment-## -->
<?php
break;
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
<?php
break;
endswitch;
}
خب الان هم از همین روش استفاده شده بود!
یعنی می خوای کدش رو ببری رو یه قالب دیگه پیاده کنی؟
اره اگه اون تکه کد رو درست برداری 100% جواب میده
فقط مشکلی که تو این جور قالب ها هست و من به همین دلیل از این قالب ها برای ویرایش استفاده نمیکنم اینکه علاوه بر قسمت کامنت سعی کرده تکه کدی از سایر بخش ها هم تو فایل فانکشن قرار بده که با برداشتن سایر کد صفحه بالا نمیاد و فکر میکنی که کد های مربوط به کامنت رو درست کپی نکردی.
البته تو وردپرس یه راهی هم هست که متونی یه قالب تعریف کنی و بگی هر موقع اینجا رسیدی برو از فلان فایل کدارو اجرا کن (همون تابع include در php)
در کل به نظر من اگه میخوای کل قالب رو تغییر بدی از قالب های ساده استفاده کن که باعث سردرگمی و کپی شدن کد های اضافی نشی
// Backwards compatibility with WordPress 3.0.if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) ) add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
if ( ! function_exists( 'twentyten_comment' ) ) :/** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own twentyten_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @since Twenty Ten 1.0 */function twentyten_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <?php echo get_avatar( $comment, 40 ); ?> <?php printf( __( '%s <span class="says"></span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?> | <?php printf(__(' %1$s '), get_comment_date()) ?>
<br /> </div><!-- .comment-author .vcard --> <?php if ( $comment->comment_approved == '0' ) : ?> <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em> <?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );?>
</div><!-- .comment-meta .commentmetadata -->
<div class="comment-body"><?php comment_text(); ?></div>
<div class="reply"> <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> </div><!-- .reply --> </div><!-- #comment-## -->
<?php break; case 'pingback' : case 'trackback' : ?> <li class="post pingback"> <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p> <?php break; endswitch;}endif;
<?php/** * The template for displaying Comments. * * The area of the page that contains both current comments * and the comment form. The actual display of comments is * handled by a callback to twentyten_comment which is * located in the functions.php file. * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */?>
<div id="comments"><?php if ( post_password_required() ) : ?> <p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyten' ); ?></p> </div><!-- #comments --><?php /* Stop the rest of comments.php from being processed, * but don't kill the script entirely -- we still have * to fully load the template. */ return; endif;?>
<?php // You can start editing here -- including this comment!?>
<?php if ( have_comments() ) : ?> <h3 id="comments-title"><?php printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ), number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' ); ?></h3>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> <div class="navigation"> <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">←</span> Older Comments', 'twentyten' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> </div> <!-- .navigation --><?php endif; // check for comment navigation ?>
<ol class="commentlist"> <?php /* Loop through and list the comments. Tell wp_list_comments() * to use twentyten_comment() to format the comments. * If you want to overload this in a child theme then you can * define twentyten_comment() and that will be used instead. * See twentyten_comment() in twentyten/functions.php for more. */ wp_list_comments( array( 'callback' => 'twentyten_comment' ) ); ?> </ol>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> <div class="navigation"> <div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">←</span> Older Comments', 'twentyten' ) ); ?></div> <div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> </div><!-- .navigation --><?php endif; // check for comment navigation ?>
<?php /* If there are no comments and comments are closed, let's leave a little note, shall we? * But we only want the note on posts and pages that had comments in the first place. */ if ( ! comments_open() && get_comments_number() ) : ?> <p class="nocomments"><?php _e( 'Comments are closed.' , 'twentyten' ); ?></p> <?php endif; ?>
<?php endif; // end have_comments() ?>
<?php comment_form(); ?>
</div><!-- #comments -->