رفتن به مطلب

مشکل با قالب دیدگاه هام!


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

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

یه کد برای قالب دیدگاه هام نوشتم و چندین بار خط به خط بررسی کردم، ولی بازم مشکل داره.

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

<!-- Comments code provided by 2tia.com -->

<!--begin password protected-->

<?php if (!empty($post->post_password) && $_COOKIE['wp-postpass_'.COOKIEHASH]!=$post->post_password) : ?>

<p class="block">جهت مشاهده نظرها، رمز را وارد کنید.</p>

<?php return; endif; //end of empty pass?>

<!--end password protected-->

<?php

/* Author values for author highlighting */

/* Enter your email and name as they appear in the admin options */

$author = array(

"highlight" => "highlight",

"email" => "YOUR EMAIL HERE",

"name" => "YOUR NAME HERE"

);

/* Count the totals */

$numPingBacks = 0;

$numComments = 0;

/* Loop throught comments to count these totals */

foreach ($comments as $comment) {

if (get_comment_type() != "comment") { $numPingBacks++; }

else { $numComments++; }

}

/* Used to stripe comments */

$thiscomment = 'odd';

?>

<!--begin track back-->

<?php if (pings_open()) : ?>

<div class="block">

<p id="respond">

<span id="trackback-link">

<a href="<?php trackback_url() ?>" rel="trackback">دریافت یک پیوند بازتاب</a>

</span>

</p>

</div>

<?php endif; //end pings?>

<?php

/* This is a loop for printing pingbacks/trackbacks if there are any */

if ($numPingBacks != 0) : ?>

<h2 class="comments-header">

<?php _e($numPingBacks); ?>

Trackbacks/Pingbacks </h2>

<ol id="trackbacks">

<?php foreach ($comments as $comment) : ?>

<?php if (get_comment_type()!="comment") : ?>

<li id="comment-<?php comment_ID() ?>" class="<?php _e($thiscomment); ?>">

<?php comment_type(__('Comment'), __('Trackback'), __('Pingback')); ?>

:

<?php comment_author_link(); ?>

در تاریخ

<?php comment_date(); ?>

</li>

<?php if('odd'==$thiscomment) { $thiscomment = 'even'; } else { $thiscomment = 'odd'; } ?>

<?php endif; endforeach; //end get comment?>

</ol>

</div>

<?php endif; //end pingbacks num ?>

<!--end track back-->

<!--check comment is open?-->

<?php if (comments_open()) : ?>

<?php /* This would be a good place for live preview...

<div id="live-preview">

<h2 class="comments-header">Live Preview</h2>

<?php live_preview(); ?>

</div>

*/ ?>

<!--check comment is open?-->

<!--begin comment form-->

<?php if (get_option('comment_registration') && !$user_ID ) : ?>

<p class="block">برای نظر دادن باید

<a href="<?php echo get_option('siteurl'); ?>?tml_page=login?redirect_to=<?php the_permalink(); ?>">وارد حساب کاربری خود شوید</a>

.</p>

<div class="comment">

<?php else : ?>

<div class="comment">

<fieldset>

<legend>

<?php if ($user_ID) :?>

<a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>

(

<a href="<?php echo wp_logout_url( get_bloginfo('url') ); ?>" title="خروج از این حساب کاربری">خروج</a>

<?php endif; //end user id?>

نظر شما چیست؟</legend>

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

<?php if (!$user_ID) : ?>

<div id="section1">

<div>

<label>نام

<?php if ($req){echo '<em>* </em>';} ?>

</label>

<input name="author" id="author" type="text" value="<?php echo $comment_author; ?>" <?php if ($req) echo "aria-required='true'"; ?> />

</div>

<div>

<label>ایمیل (منتشر نمی شود)

<?php if ($req){echo '<em>* </em>';} ?>

</label>

<input name="email" id="email" type="text" value="<?php echo $comment_author_email; ?>" <?php if ($req) echo "aria-required='true'"; ?> />

</div>

<div>

<label>وبسایت</label>

<input name="url" id="url" type="text" value="<?php echo $comment_author_url; ?>" />

</div>

<?php do_action('comment_form', $post->ID); ?>

</div>

<?php endif; //end user id ?>

<div>

<label id="textarea">متن نظر<em>* </em></label>

<textarea name="comment" id="comment" cols="" rows="" <?php if ($user_ID) echo 'style="width: 583px"'; ?>></textarea>

</div>

<input name="comment_post_ID" type="hidden" value="<?php echo $id; ?>" />

<input name="submit" type="submit" value="ارسال" />

<?php do_action('comment_form', $post->ID); ?>

</form>

<?php show_subscription_checkbox(); ?>

</fieldset>

<!--end comment form-->

<?php

if (!$Comments) :

?>

<div class="block message">

<h3>هنوز نظری داده نشده است.</h3>

<p>اولین نفری باشید که نظر خود را در مورد این مطلب بیان می کند!</p>

</div>

<?php else :

/* No comments at all means a simple message instead */

?>

<?php

/* This is a loop for printing comments */

?>

<fieldset>

<legend> نظرات

(

<?php _e($numComments); ?>

نظر) </legend>

<ol>

<?php foreach ($comments as $comment) : ?>

<?php if (get_comment_type()=="comment") : ?>

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

/* Highlighting class for author or regular striping class for others */

/* Get current author name/e-mail */

$this_name = $comment->comment_author;

$this_email = $comment->comment_author_email;

/* Compare to $author array values */

if (strcasecmp($this_name, $author["name"])==0 && strcasecmp($this_email, $author["email"])==0)

_e($author["highlight"]);

else

_e($thiscomment);

?>">

<img src="<?php get_avatar(60); ?>" alt="<?php comment_author(); ?>" class="avatar" width="60" height="60" />

<div class="comment-meta">

<?php /* If you want to use gravatars, they go somewhere around here */ ?>

<span class="comment-author">

<?php comment_author_link() ?>

</span>در تاریخ <span class="comment-date">

<?php comment_date('d M Y') ?>

</span>گفته: </div>

<div class="comment-text">

<?php comment_text(); ?>

</div>

</li>

<?php if('odd'==$thiscomment) { $thiscomment = 'even'; } else { $thiscomment = 'odd'; } ?>

<?php endif; //end get comment type

endforeach; ?>

</ol>

</fieldset>

<?php endif; //// no comment ?>

<?php endif; // If registration required and not logged in ?>

<?php else : // Comments are closed ?>

<p class="block message">متاسفانه امکان نظردهی به این مطلب، توسط مدیر مسدود شده است.</p>

<?php endif; ?>

اینم بگم کار راحت تر بشه. شرط بررسی باز بودن دیدگاه:

<?php if (comments_open()) : ?>

البته دوستان می دونن دیگه.

چون کد زیاده گفتم.

ویرایش شده توسط Morteza
لینک به ارسال
مشکلشم اینه که وقتی از مدیریت دیدگاه ها رو برای پست فعال می کنید، به جای نمایش پیامی که در قالب هست، کل بخش قالب حذف میشه

چه پیامی هست که باید نمایش داده بشه؟

لینک به ارسال

چه پیامی هست که باید نمایش داده بشه؟


<p class="block message">متاسفانه امکان نظردهی به این مطلب، توسط مدیر مسدود شده است.</p>

لینک به ارسال

چک کنید

<!-- Comments code provided by 2tia.com -->

<!--begin password protected-->

<?php if (!empty($post->post_password) && $_COOKIE['wp-postpass_'.COOKIEHASH]!=$post->post_password) : ?>

<p class="block">جهت مشاهده نظرها، رمز را وارد کنید.</p>

<?php return; endif; //end of empty pass?>

<!--end password protected-->

<?php

/* Author values for author highlighting */

/* Enter your email and name as they appear in the admin options */

$author = array(

"highlight" => "highlight",

"email" => "YOUR EMAIL HERE",

"name" => "YOUR NAME HERE"

);

/* Count the totals */

$numPingBacks = 0;

$numComments = 0;

/* Loop throught comments to count these totals */

foreach ($comments as $comment) {

if (get_comment_type() != "comment") { $numPingBacks++; }

else { $numComments++; }

}

/* Used to stripe comments */

$thiscomment = 'odd';

?>

<!--begin track back-->

<?php if (pings_open()) : ?>

<div class="block">

<p id="respond">

<span id="trackback-link">

<a href="<?php trackback_url() ?>" rel="trackback">دریافت یک پیوند بازتاب</a>

</span>

</p>

</div>

<?php endif; //end pings?>

<?php

/* This is a loop for printing pingbacks/trackbacks if there are any */

if ($numPingBacks != 0) : ?>

<h2 class="comments-header">

<?php _e($numPingBacks); ?>

Trackbacks/Pingbacks </h2>

<ol id="trackbacks">

<?php foreach ($comments as $comment) : ?>

<?php if (get_comment_type()!="comment") : ?>

<li id="comment-<?php comment_ID() ?>" class="<?php _e($thiscomment); ?>">

<?php comment_type(__('Comment'), __('Trackback'), __('Pingback')); ?>

:

<?php comment_author_link(); ?>

در تاریخ

<?php comment_date(); ?>

</li>

<?php if('odd'==$thiscomment) { $thiscomment = 'even'; } else { $thiscomment = 'odd'; } ?>

<?php endif; endforeach; //end get comment?>

</ol>

</div>

<?php endif; //end pingbacks num ?>

<!--end track back-->

<!--check comment is open?-->

<?php if (comments_open()) : ?>

<?php /* This would be a good place for live preview...

<div id="live-preview">

<h2 class="comments-header">Live Preview</h2>

<?php live_preview(); ?>

</div>

*/ ?>

<!--check comment is open?-->

<!--begin comment form-->

<?php if (get_option('comment_registration') && !$user_ID ) : ?>

<p class="block">برای نظر دادن باید

<a href="<?php echo get_option('siteurl'); ?>?tml_page=login?redirect_to=<?php the_permalink(); ?>">وارد حساب کاربری خود شوید</a>

.</p>

<div class="comment">

<?php else : ?>

<div class="comment">

<fieldset>

<legend>

<?php if ($user_ID) :?>

<a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>

(

<a href="<?php echo wp_logout_url( get_bloginfo('url') ); ?>" title="خروج از این حساب کاربری">خروج</a>

<?php endif; //end user id?>

نظر شما چیست؟</legend>

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

<?php if (!$user_ID) : ?>

<div id="section1">

<div>

<label>نام

<?php if ($req){echo '<em>* </em>';} ?>

</label>

<input name="author" id="author" type="text" value="<?php echo $comment_author; ?>" <?php if ($req) echo "aria-required='true'"; ?> />

</div>

<div>

<label>ایمیل (منتشر نمی شود)

<?php if ($req){echo '<em>* </em>';} ?>

</label>

<input name="email" id="email" type="text" value="<?php echo $comment_author_email; ?>" <?php if ($req) echo "aria-required='true'"; ?> />

</div>

<div>

<label>وبسایت</label>

<input name="url" id="url" type="text" value="<?php echo $comment_author_url; ?>" />

</div>

<?php do_action('comment_form', $post->ID); ?>

</div>

<?php endif; //end user id ?>

<div>

<label id="textarea">متن نظر<em>* </em></label>

<textarea name="comment" id="comment" cols="" rows="" <?php if ($user_ID) echo 'style="width: 583px"'; ?>></textarea>

</div>

<input name="comment_post_ID" type="hidden" value="<?php echo $id; ?>" />

<input name="submit" type="submit" value="ارسال" />

<?php do_action('comment_form', $post->ID); ?>

<?php comment_id_fields(); ?>

<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER["REQUEST_URI"]); ?>" /></div>

</form>

<?php show_subscription_checkbox(); ?>

</fieldset>

<!--end comment form-->

<?php

if (!$Comments) :

?>

<div class="block message">

<h3>هنوز نظری داده نشده است.</h3>

<p>اولین نفری باشید که نظر خود را در مورد این مطلب بیان می کند!</p>

</div>

<?php else :

/* No comments at all means a simple message instead */

?>

<?php

/* This is a loop for printing comments */

?>

<fieldset>

<legend> نظرات

(

<?php _e($numComments); ?>

نظر) </legend>

<ol>

<?php foreach ($comments as $comment) : ?>

<?php if (get_comment_type()=="comment") : ?>

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

/* Highlighting class for author or regular striping class for others */

/* Get current author name/e-mail */

$this_name = $comment->comment_author;

$this_email = $comment->comment_author_email;

/* Compare to $author array values */

if (strcasecmp($this_name, $author["name"])==0 && strcasecmp($this_email, $author["email"])==0)

_e($author["highlight"]);

else

_e($thiscomment);

?>">

<img src="<?php get_avatar(60); ?>" alt="<?php comment_author(); ?>" class="avatar" width="60" height="60" />

<div class="comment-meta">

<?php /* If you want to use gravatars, they go somewhere around here */ ?>

<span class="comment-author">

<?php comment_author_link() ?>

</span>در تاریخ <span class="comment-date">

<?php comment_date('d M Y') ?>

</span>گفته: </div>

<div class="comment-text">

<?php comment_text(); ?>

</div>

</li>

<?php if('odd'==$thiscomment) { $thiscomment = 'even'; } else { $thiscomment = 'odd'; } ?>

<?php endif; //end get comment type

endforeach; ?>

</ol>

</fieldset>

<?php endif; //// no comment ?>

<?php endif; // If registration required and not logged in ?>

<?php else : // Comments are closed ?>

<p class="block message">متاسفانه امکان نظردهی به این مطلب، توسط مدیر مسدود شده است.</p>

<?php endif; ?>

لینک به ارسال

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

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

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

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

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

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

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

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

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