رفتن به مطلب

تغییر رنگ نظر نویسنده ( حلقه مطلبم متفاوته )


پست های پیشنهاد شده

سلام دوستان من می خوام استایل نظر نویسنده پست متمایز باشه . من تمام موردهای موجود رو تست کردم و هیچکدوم جواب نداد . اینم حلقه نظراتم . کمک کنید ممنون می شم . اگه هم اشتباه نکنم از کدهای پیشفرض خود وردپرس استفاده می کنه چون تابعش اینه :wp_list_comments

اینم آدرس وبم اگه لازم بشه http://aseman.xzn.ir


<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.', __SLUG__ ); ?></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() ) : ?>
<h2> <?php comments_number(__('No Comment', __SLUG__), __('1 Comment', __SLUG__), __('% Comments', __SLUG__)); ?> </h2>
<?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', __SLUG__ ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">→</span>', __SLUG__ ) ); ?></div>
</div> <!-- .navigation -->
<?php endif; // check for comment navigation ?>
<ol class="comments">
<?php

wp_list_comments( array( 'callback' => 'agt_comments_template' ) );
?>
</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', __SLUG__ ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">→</span>', __SLUG__ ) ); ?></div>
</div><!-- .navigation -->
<?php endif; // check for comment navigation ?>
<?php else : // or, if we don't have comments:
/* If there are no comments and comments are closed,
* let's leave a little note, shall we?
*/
if ( ! comments_open() ) :
?>
<p class="nocomments"><?php if (is_single()) { _e('Comments are closed.', __SLUG__);} ?></p>
<?php endif; // end ! comments_open() ?>
<?php endif; // end have_comments()
$aria_req = ( $req ? " aria-required='true'" : '' ); //accesibility stuff
?>
<?php
$defaults = array('fields' => apply_filters( 'comment_form_default_fields', array(
'author' => '<label for="author">' . __('Name', __SLUG__) .'<span>(required)</span></label> <input id="author" name="author" type="text" class="text" value="' .esc_attr( $commenter['comment_author'] ) . '" ' . $aria_req . ' />',
'email' => '<label for="email">' . __('Email', __SLUG__) . '<span>(required)</span></label><input id="email" name="email" type="text" class="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" ' . $aria_req . ' />','url' => '<label for="url">' . __('Website', __SLUG__) . '</label><input id="url" name="url" type="text" class="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" />') ),
'comment_field' => '<label for="comment">' . __('Message', __SLUG__) . ' <span>(required)</span></label><textarea id="comment" name="comment" rows="10" class="textarea" tabindex="4" aria-required="true"></textarea>',
'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.', __SLUG__ ), wp_login_url() ) . '</p>',
'comment_notes_before' => ' ',
'comment_notes_after' => ' ',
'id_submit' => 'submitC',
'title_reply' => __('Leave a comment', __SLUG__),
'title_reply_to' => __('Reply', __SLUG__ ),
'cancel_reply_link' => __('Cencel Reply', __SLUG__),
'label_submit' => __('Submit Comment', __SLUG__)
);

?>
<?php comment_form($defaults); ?>
</div><!-- #comments -->

لینک به ارسال

مرسی داداش . اینارو هم نیگا کردم . با این استایل می دهم .comment-author-admin پس زمینش تغییر رنگ پیدا می کنه . یه اسکرین شات همی میزارم که ببینی .

Untitled-1.jpg

در ضمن از کدهای پیشفرض وردپرس استفاده می کنه تو function.php لود نمیشه یه جای دیگه لود میشه که اینم کدشه . مرسی


/* Comment Template */
function agt_comments_template($comment, $args, $depth){
$GLOBALS['comment'] = $comment;
?>
<li <?php if($depth > 1) {echo comment_class('comm_reply');} else {echo comment_class();}; ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>" class="postbox marginbottom">
<div class="postboxmain comment-body">
<?php echo get_avatar($comment,$size='55'); ?>
<div class="comment-content">
<h5><?php echo get_comment_author_link(); ?></h5>
<span class="date"><?php printf(__('%1$s at %2$s', __SLUG__), get_comment_date(), get_comment_time()) ?><?php edit_comment_link(__('(Edit)', __SLUG__),' ','') ?></span>
<?php if ($comment->comment_approved == '0') : ?>
<em><?php _e('Your comment is awaiting moderation.', __SLUG__) ?></em>
<?php endif; ?>
<?php comment_text() ?>
<?php $args['reply_text'] = __('Reply', __SLUG__); ?>
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div>

ویرایش شده توسط javidkhah
لینک به ارسال

میتونید آدرس سایت رو بدید تا خروجی رو بررسی کنیم؟

لینک به ارسال

کدوم پست نظر داره؟ :)

aseman.xzn.ir/?p=7 . در ضمن شما که میری تو قسمت نظرات اینم به من بگو دیگه . یه کد نوشتم که وقتی موس رو میبری روی قسمت نظر لینک پاسخ میاد و وقتی موس رو بر می داری میره . با جاوا نوشتم ولی یه مشکل داره که پاسخ همه ی نظرات رو میاره و میاره و من می خوام اونی که فقط موس روی اونه بیاره . تست کنی میبینی چی میگم . شرمنده ها

لینک به ارسال

الان کلاسی منحصر به فرد comment-author-admin برای ارسال های شما ایجاد شده

به همین استایل بدید

شما باید بجای اسم کلاس در رویداد موس آور به this اشاره کنید

لینک به ارسال
الان کلاسی منحصر به فرد comment-author-admin برای ارسال های شما ایجاد شده به همین استایل بدید شما باید بجای اسم کلاس در رویداد موس آور به this اشاره کنید

از این کلاس استفاده می کنم ولی رنگ بغلشو عوض می کنه . از خیرش گذشتم . کدش یه جوریه نمیشه . در مورد کد دوم هم میشه یه نمونه عملی بدین ؟ مرسی یا این کد رو ویرایش کنی .


<script type="text/javascript">
$(document).ready(function() {
$(".comment-body").mouseover(function() {
$(".comment-reply-link").css('opacity', '1');
});
$(".comment-body").mouseout(function() {
$(".comment-reply-link").css('opacity', '0');
});
});
</script>

بازم مرسی

لینک به ارسال

تست کنید:

					    $(document).ready(function() {
$(".comment-body").mouseover(function() {
$(this).find(".comment-reply-link").css('opacity', '1');
});
$(".comment-body").mouseout(function() {
$(this).find(".comment-reply-link").css('opacity', '0');
});
});

لینک به ارسال

تست کنید:

					 $(document).ready(function() {
$(".comment-body").mouseover(function() {
$(this).find(".comment-reply-link").css('opacity', '1');
});
$(".comment-body").mouseout(function() {
$(this).find(".comment-reply-link").css('opacity', '0');
});
});

داداش دستت درست . خیلی خیلی ممنون . خیلی از کارام راه میوفته با این کد . مرسی مرسی مرسی

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...