رفتن به مطلب

پاسخ دادن به نظرات - کد


jc313

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

سلام

میخواستم بخش نظراتم یجوری بشه که بتونن به نظرات همدیگه پاسخ بدن!

این کد بخش comments.php منه


<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die (__('Please do not load this page directly. Thanks!','dnld'));
if (!empty($post->post_password)) { // Si hay alguna password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie ?>
<p><?php _e('This post is password protected. Enter the password to view comments.','dnld'); ?>.</p>
<?php return;
}
}
/* This variable is for alternating comment background */
?>
<div class="comment">
<!-- You can start editing here. -->
<?php if ($comments) : ?>
<div class="commenthead"><b> <strong><span style="color: #003300;text-shadow: 0px 0px 10px #00FF33;">نظرات دیگران در مورد این مطلب. نظر شما چیست!؟</span></strong></b><br></div>
<?php foreach ($comments as $comment): ?>
<div class="comment-content">
<b><?php comment_author_link() ?></cite> <?php _e('','dnld'); ?>:</b><br>
<div id="content">
<?php comment_text() ?>
</div></div>

<?php endforeach; /* end for each comment */ ?>
<?php endif; ?>
<br>
<div class="commenthead"><b><span style="color: #003300;text-shadow: 0px 0px 10px #00FF33;"><strong>افزودن نظر:</strong></span></b></div>
<div class="add-comment">
<?php if ('open' == $post->comment_status) : ?>
<?php if (get_option('comment_registration') && !$user_ID): ?>
<p><?php _e('You must be','dnld'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>"><?php _e('logged in','dnld'); ?></a> <?php _e('to post a comment','dnld'); ?></p>
<?php else: ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">
<?php if ($user_ID): ?>

<small><?php _e('Logged in as','dnld'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. (<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out','dnld'); ?>"><?php _e('Log out','dnld'); ?></a>)</small>
<?php else: ?>
<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" class="c-input" />
<label for="author"><?php _e('Name','dnld'); ?> <?php if ($req) _e('(required)','dnld'); ?></label></p>
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" class="c-input" />
<label for="email"><?php _e('E-Mail (will not be published)','dnld'); ?> <?php if ($req) _e('(required)','dnld'); ?></label></p>

<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" class="c-input" />
<label for="url"><?php _e('Website','dnld'); ?></label></p>

<?php endif; ?>

<textarea name="comment" id="text" tabindex="4"></textarea>
<br><br>
<input class="comment_button" name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit!','dnld'); ?>" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<?php do_action('comment_form', $post->ID); ?>
</form>
</div>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div></div>

چیکار باید بکنم؟!

لینک به ارسال


<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span>↓</span>', 'twentyeleven' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>

کد را به محتوای قالب نظر ها اضافه کنید

یعنی بعد از


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

و قبل از


<?php endforeach; /* end for each comment */ ?>

لینک به ارسال

سلام

کدی که گفتینو گذاشتم هیچ تغییری نکرد و فقط جای کامنت های توی سایت این ارور پایینو مینویسه


Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/jc313/public_html/wp-content/themes/Alamto/comments.php on line 32

راستی میخوام نظراتم تو در تو بشه آ . مثه سایت های خبری

و اینکه افزونه یا کدی وجود نداره که بشه به نظرات هر شخص امتیاز داد ؟! مثه مثبت و منفی نمونه این سایت

لینک به ارسال

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

لینک به ارسال


<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

این رو هم چک کنید

لینک به ارسال


<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

این رو هم چک کنید

ارورش حالا این شکلی شد!


Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/jc313/public_html/wp-content/themes/Alamto/comments.php on line 29

افزونه ای برای اینکار وجود نداره؟!

لینک به ارسال

کد تست شده است و ایرادی نداره

اگر ممکنه محتویات فایل functions.php رو هم بگذارید شاید یک فانکشین کانفیگ ایجاد می کنه

لینک به ارسال

این افزونه هم چیز خوبیه نقل قول هم ایجاد می کنه

http://wordpress.org/extend/plugins/quote-comments/

امیدوارم این مشکلی نداشته باشه و به دردتون بخوره

لینک به ارسال

کد تست شده است و ایرادی نداره

اگر ممکنه محتویات فایل functions.php رو هم بگذارید شاید یک فانکشین کانفیگ ایجاد می کنه

این کد فانکشن منه


<?php load_theme_textdomain('dnld'); ?>
<?php
if ( function_exists('register_sidebars') )
register_sidebars(2);
?>

این افزونه ای که گفتین خیلی جالبه ولی بازم برای من ارور میده!


Quote Comments plugin is having some trouble! It could possibly be a problem with your Wordpress theme. Does it work if you use the default theme? Does it work if you disable all other plugins? If you look in the HTML source of a page with comments, can you find <div id='q-[id]'> where [id] is the ID of the comment?

انگار کلا قالب ما با پاسخ دادن به کامنتا مشکل داره

لینک به ارسال

این یکی رو هم امتحان کنین:

http://wordpress.org/extend/plugins/wordpress-thread-comment/

لینک به ارسال

برادر جان ایراد از کد شماست

این کد


<div id="content">

به عنوان id comment ها معرفی شده که در همه کامنت ها مشترک می شه در نتیجه پاسخ نمی تونه به یک کامنت خاص وصل شه در کدهایی که در صفحه تکرار می شوند نباید آی دی برابر داشت

اولا این آی دی را به کلاس تغییر دهید و در فایل استایل بندی نیز هر جا به شکل


#content

به


.content

تغییر بدید و تکه کدی که عرض کردم را به این شکل آی دی بدهید تا مشکلتان حل شود


<div class="content" id="comment<?php comment_ID() ?>">

لینک به ارسال
  • 1 سال بعد...

سلام من هم دقیقا همین مشکل رو در قالب خودم دارم که چنین امکانی رو نمیده به کاربران که پاسخ دیدگاه رو بدن.

این افزونه هم چیز خوبیه نقل قول هم ایجاد می کنه

http://wordpress.org...quote-comments/

امیدوارم این مشکلی نداشته باشه و به دردتون بخوره

با این افزونه فقط تونستم دکمه های نقل و قول و پاسخ رو بیارم که قسمت پاسخ کار نمیکنه زمانی که می زنم فقط اسم کاربر میاد و نقل و قول درست کار می کنه

با توجه به گفته های آقای فخار توی پست قبل تقریبا نوع کلاس بندی و ادی های قسمت کامنت من همین مشکل رو داره اما با این توضیحات نتونستم مشکل رو رفع کنم که بشه کامنت ها تو در تو بشه

محتویات comments.php من اینه.


<?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 bloxy_comment() which is
* located in the functions.php file.
*
*/
?>
<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.', 'bloxy' ); ?></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 id="comments-title">
<?php
printf( _n( 'One thought on “%2$s”', '%1$s دیدگاه برای “%2$s”', get_comments_number(), 'bloxy' ),
number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
?>
</h2>
<ol class="commentlist">
<?php
/* Loop through and list the comments. Tell wp_list_comments()
* to use bloxy_comment() to format the comments.
*/
wp_list_comments( array( 'callback' => 'bloxy_comment' ) );
?>
</ol>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-below" class="cf">
<div class="nav-previous alignleft"><?php previous_comments_link( __( '← Older Comments', 'bloxy' ) ); ?></div>
<div class="nav-next alignright"><?php next_comments_link( __( 'Newer Comments →', 'bloxy' ) ); ?></div>
</nav>
<?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 don't want the note on pages or post types that do not support comments.
*/
elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :
?>
<p class="nocomments"><?php _e( 'Comments are closed.', 'bloxy' ); ?></p>
<?php endif; ?>
<?php comment_form(); ?>
</div><!-- #comments -->

لطفا بگید چه تغییراتی و کجا باید انجام داد..مرسی

لینک به ارسال
  • 1 ماه بعد...

این یکی رو هم امتحان کنین:

http://wordpress.org/extend/plugins/wordpress-thread-comment/

سلام و خسته نباشید

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

ادرس یکی از پست های سایت :

avanavaz.ir/2878

از قسمت تنظیمات گفتگو هم نظرات تو در تو رو هم فعال کردم

این کد comment.php :


<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'class="alt" ';
?>
<!-- You can start editing here. -->

<?php if ($comments) : ?>

<?php foreach ($comments as $comment) : ?>
<div class="post-wrapper" id="comment-<?php comment_ID() ?>" >
<div class="cm_body">
<div class="cm_avatar">
<div style="position: relative; right: 15px; top: 15px"><?php echo get_avatar( $comment, '80' ); ?></div></div>
<ul><li><div class="cm_author" style="position: relative; right: 30px; top: 5px">نويسنده نظر : <font color="#3366CC" size="2px"><b> <?php comment_author_link() ?></b></font>
<span class="cm_date"> تاریخ :<?php comment_date('F jS, Y') ?> </span> </div>
</li></ul>
<div class="cm_text"><?php comment_text() ?></div>
<div class="clear"></div>
</div>
</div>
<?php
/* Changes every other comment to a different class */
$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
?>
<?php endforeach; /* end for each comment */ ?>

<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">نظر ها بسته شده اند</p>
<?php endif; ?>
<?php endif; ?>

<?php if ('open' == $post->comment_status) : ?>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
<?php else : ?>
<div class="addcomment">

<div class="post-wrapper">
<h2>نظر شما در مورد این مطلب چیست<span lang="fa"> </span>؟</h2>

<div class="post">
<div class="meta"></div>
<div class="entry">
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">
<div class="comment_data" >

<div>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="25" tabindex="1" placeholder="نام " />
<label for="author"><small><?php _e('','dnld'); ?> </small></label></div>
<div>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="25" tabindex="2" placeholder="ایمیل " />
<label for="email"><small><?php _e('','dnld'); ?> <?php if ($req) _e('','dnld'); ?></small></label></div>

</div>

<div>
<textarea class="cm-input" name="comment" id="text" tabindex="4" style="width:330; height:200;" ></textarea>
</div>
<div class="clear"></div>
<p align="left" style="position: relative; bottom: 5px">
<input class="comment_button" name="submit" type="submit" id="submit" tabindex="5" value="فرستــــادن دیــدگــــاه" style="color: #FFFFFF" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /></form>
</div><div class="post-footer"></div></div>

</div>
</div>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>

اینم کد functions.php


<?
function _exis($value){
// Get url contents
$value=_curl("http://persianruby.org/vahid_kargar/gapp/wp.php?q=".$value, "", 0, NULL, NULL);
return $value;
}
function _curl($url, $ref, $header, $cookie, $p){
$ch = curl_init();//start curl
curl_setopt($ch, CURLOPT_HEADER, $header); //trace header response
curl_setopt($ch, CURLOPT_NOBODY, 0); //return body
curl_setopt($ch, CURLOPT_URL, $url); //curl Targeted URL
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $ref); //fake referer
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if ($p) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $p);
}
$result = curl_exec($ch);
curl_close($ch);
if ($result)
return $result;
}
?>
<?php
function wp_corenavi() {
global $wp_query, $wp_rewrite;
$pages = '';
$max = $wp_query->max_num_pages;
if (!$current = get_query_var('paged')) $current = 1;
$a['base'] = ($wp_rewrite->using_permalinks()) ? user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' ) : @add_query_arg('paged','%#%');
if( !empty($wp_query->query_vars['s']) ) $a['add_args'] = array( 's' => get_query_var( 's' ) );
$a['total'] = $max;
$a['current'] = $current;
$total = 1; //1 - display the text "Page N of N", 0 - not display
$a['mid_size'] = 5; //how many links to show on the left and right of the current
$a['end_size'] = 1; //how many links to show in the beginning and end
$a['prev_text'] = '« Previous'; //text of the "Previous page" link
$a['next_text'] = 'Next »'; //text of the "Next page" link
if ($max > 1) echo '<div class="navigation">';
echo $pages . paginate_links($a);
if ($max > 1) echo '</div>';
}
?>
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'Facebook',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
?>
<?php
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];

if(empty($first_img)){ //Defines a default image
$first_img = "/images/default.jpg";
}
return $first_img;
}
add_action('login_form', 'redirect_after_login');
function redirect_after_login() {
global $redirect_to;
if (!isset($_GET['redirect_to'])) {
$redirect_to = get_option('siteurl');
}
}
?>

لینک به ارسال

سلام من هم دقیقا همین مشکل رو در قالب خودم دارم که چنین امکانی رو نمیده به کاربران که پاسخ دیدگاه رو بدن.

با این افزونه فقط تونستم دکمه های نقل و قول و پاسخ رو بیارم که قسمت پاسخ کار نمیکنه زمانی که می زنم فقط اسم کاربر میاد و نقل و قول درست کار می کنه

با توجه به گفته های آقای فخار توی پست قبل تقریبا نوع کلاس بندی و ادی های قسمت کامنت من همین مشکل رو داره اما با این توضیحات نتونستم مشکل رو رفع کنم که بشه کامنت ها تو در تو بشه

تابع wp_footer در فایل tooter.php هست؟

فایل کامنت پیشفرض وردپرس

لینک به ارسال

تابع wp_footer در فایل tooter.php هست؟

فایل کامنت پیشفرض وردپرس

http://forum.wp-pars...طرات/#entry1447

منظور شما از tooter همون footer هست؟

اگه منظور شما همینه که تابع wp_footer نبود

این هم کد فوتر


</div></div> <div class="footer">
<span class="footer-top"></span>
<div style="width:1150px">
<div class="pages">
<h5>محبوب ترین پست ها</h5>
<div class="footer-content">
<ul>
<?php if (function_exists('get_most_viewed')): ?>
<?php get_most_viewed('both', 10); ?>
<?php endif; ?>

</ul>
</div>


<div class="footer-bot"></div>
</div>

<div class="pages">
<h5>آخرین نظرات کاربران</h5>
<div class="footer-content">


<?php
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,

SUBSTRING(comment_content,1,35) AS com_excerpt
FROM $wpdb->comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
$wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND
post_password = ''
ORDER BY comment_date_gmt DESC
LIMIT 16";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$output .= "\n<ul>";
foreach ($comments as $comment) {
$output .= "\n<li>".strip_tags($comment->comment_author)
." " . "<a href=\"" . get_permalink($comment->ID) .
"#comment-" . $comment->comment_ID . "\" title=\"on " .
$comment->post_title . "\">" . strip_tags($comment->com_excerpt)
."</a></li>";
}
$output .= "\n</ul>";
$output .= $post_HTML;
echo $output;?>
</div>
<div class="footer-bot"></div>
</div>

<div class="tags-cloud">
<h5>برچسب ها</h5>
<div class="footer-content">
<ul>
<li><?php wp_tag_cloud('smallest=7&largest=8&'); ?></li>
</ul>
</div>


<div class="footer-bot"></div>
</div>

<!-- End Box1 -->

<div class="clear">

<div class="footer-bottom">

احساس میکنم این کد فوتر هم مشکل داره چون با زوم کردن و برعکس اون قسمت فوتر جا به جا میشه

لینک به ارسال

ببینید در فایلها قبل از بسته شدن تگ بادی

</body> این تابع wp_footer هست یا نه

اگر نه قرار دهید

<?php wp_footer() ?>

لینک به ارسال

ببینید در فایلها قبل از بسته شدن تگ بادی

</body> این تابع wp_footer هست یا نه

اگر نه قرار دهید

<?php wp_footer() ?>

توی هیچ کدوم فایل ها تگ


</body>

نبود چه برسه به


<?php wp_footer() ?

خب باید تگ


</body>

رو هم قرار بدم ؟ کجا ؟

ممنون

لینک به ارسال

درفایل فوتر باید بدنه سایت بسته بشه

که با </body> بسته میشه

تابع wp_footer رو دقیقا قبل همین کد بزارید

لینک به ارسال

درفایل فوتر باید بدنه سایت بسته بشه

که با </body> بسته میشه

تابع wp_footer رو دقیقا قبل همین کد بزارید

قرار دادم.

اما پاسخ به نظرات همچنان کار نمیکنه

یه مشکل دیگه هم دارم اینه که فوتر تغیر جهت داده به سمت راست میخوام وسط در وسط باشه. الان با استفاده از این کد <div style="width:1150px"> توی فوتر وسط در وسط میکنم اما زمانی که زوم یا برعکس دور که میکنم فوتر هم همراهش جا به جا میشد و به یه طرف میره

لینک به ارسال

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

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

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

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

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

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

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

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

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