In my site just log in user can send comment and if you not loged in , when you send comment the site unsettles.
site:click
This problem happen with all wordpress comment plugins , but with out plugins it’s true and user send comment but send comments do not show and again the site unsettles in posts that have comments.
this problem:click
This problem is just in this theme.
my function:
<?php
function my_favicon() { ?>
<link href="http://itarfand.com/wp-content/themes/itarfand/favicon.png
" rel="shortcut icon" type="image/x-icon">
<?php }
add_action('wp_head', 'my_favicon');
add_action('admin_head', 'show_favicon');
function show_favicon() {
echo '<link href="http://itarfand.com/wp-content/themes/itarfand/favicon.png" rel="icon" type="image/x-icon">';
}
if ( is_rtl() ) {
wp_enqueue_style('style-rtl', get_template_directory_uri() . '/css/style-rtl.css');
} else {
wp_enqueue_style('style-ltr', get_template_directory_uri() . '/css/style-ltr.css');
}
?>
<?php function wpfme_feed_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) {
$content = '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'wpfme_feed_post_thumbnail');
add_filter('the_content_feed', 'wpfme_feed_post_thumbnail');
?>
<?php
function new_excerpt_length($length) {
return 100;
}
add_filter('excerpt_length', 'new_excerpt_length');
function custom_excerpt_more($more) {
return ' ... ';
}
add_filter('excerpt_more', 'custom_excerpt_more');
?>
<?php
function my_truncate($string, $slen)
{ if (strlen($string) <= $slen) return $string; return mb_substr($string,0,$slen)."..."; }
function post_title($char) {
$title = get_the_title($post->ID);
echo my_truncate($title,75); }
function side_title($char) {
$title = get_the_title($post->ID);
echo my_truncate($title,30); }
?>
<?php
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
add_action( 'widgets_init', 'my_remove_recent_comments_style' );
function my_remove_recent_comments_style() {
global $wp_widget_factory;
remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
function _remove_script_version( $src ) {
$parts = explode( '?', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
// mfamo unapproved comments
global $post;
$mfamo_unapproved_comments = get_comments( array( 'status' => 'hold', 'post_ID' => isset($post->ID) , 'count' => true ) );
// Post id in wordpress admin
add_filter('manage_posts_columns', 'posts_columns_id', 5);
add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2);
add_filter('manage_pages_columns', 'posts_columns_id', 5);
add_action('manage_pages_custom_column', 'posts_custom_id_columns', 5, 2);
function posts_columns_id($defaults){
$defaults['wps_post_id'] = 'آيدي پست' ;
return $defaults;
}
function posts_custom_id_columns($column_name, $id){
if($column_name === 'wps_post_id'){
echo $id;
}
}
// thumbnail
add_theme_support('post-thumbnails');
if (function_exists('add_image_size')){
add_image_size( 'listen', 90, 90, true);
add_image_size( 'mnm', 224, 224, true);
add_image_size( 'poster', 700, 500, true);
}
//sidebar
function snippets_widgets_init() {
if(function_exists('register_sidebar') ){
register_sidebar(array(
'name'=> 'ابزارک راست',
'id'=> 'right_widgets',
'before_widget' => '<div class="side-box row">',
'after_widget'=> '
</div>',
'before_title'=> '
<div class="title row"><span class="col"><i class="icon icon-wifi-w col"></i></span>',
'after_title' => '
</div>',
));
}
}
function famo_nav_fallback(){echo '<p style="text-align: justify;">باید از پیشخوان » نمایش » فهرست ها ، لینک های خود را قرار دهید.</p><p style="text-align: justify;"><a style="font-weight: bold;" target="_blank" href="http://mfamo.com/post/365/">آموزش ساخت فهرست و تنظيم منو در وردپرس</a></p>';}
add_action( 'widgets_init', 'snippets_widgets_init' );
//meta box
function add_custom_meta_box() {
add_meta_box(
'custom_meta_box',
'زمينه هاي دلخواه !',
'show_custom_meta_box',
'post',
'normal',
'high');
}
add_action('add_meta_boxes', 'add_custom_meta_box');
$prefix = '';
$custom_meta_fields = array(
array('label'=> '<b style="color:#3297da">اطلاعات مربوط جعبه دانلود و زمینه دلخواه</b>',),
array('label'=> '',),
array('label'=> '',),
array(
'label'=> 'پست غیر رایگان',
'desc' => 'اگر پست غیر رایگان است ، این تیک را بزنید .',
'id'=> 'vip-post',
'type' => 'checkbox'
),
array( ),
array( ),
array( ),
array( ),
array( ),
array(
'label'=> 'متن فایل برای دانلود',
'desc' => 'مثال : دانلود آموزش برای موبایل',
'id'=> 'text-dl',
'type' => 'text'
),
array(
'label'=> 'لینک فایل برای دانلود',
'desc' => 'حتما اول آن http:// را وارد کنید',
'id'=> 'link-dl',
'type' => 'text'
),
array(
'label'=> 'رمز فایل',
'desc' => 'مثال : itarfand.com',
'id'=> 'pass-file',
'type' => 'text'
),
array(
'label'=> 'حجم فایل',
'desc' => 'مثال : 1 مگابایت',
'id'=> 'size-file',
'type' => 'text'
),
array(
'label'=> 'لینک دانلود راهنمای نصب',
'desc' => 'حتما اول آن http:// را وارد کنید',
'id'=> 'help-file',
'type' => 'text'
),
array( ),
array(
'label'=> 'متن منبع',
'desc' => 'مثال : ترفندها',
'id'=> 'text-manba',
'type' => 'text'
),
array(
'label'=> 'لینک منبع (اختیاری)',
'desc' => 'حتما اول آن http:// را وارد کنید',
'id'=> 'link-manba',
'type' => 'text'
),
array( ),
array( ),
array( ),
array( ),
array(
'label'=> 'بازدید اولیه مطلب (اختیاری)',
'desc' => 'هر عددی را وارد کنید به عنوان بازدید اولیه محاسبه میشود و اگر وارد نکنید از 0 شروع میشود .',
'id'=> 'views',
'type' => 'text'
),
);
function show_custom_meta_box() {
global $custom_meta_fields, $post;
echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';
echo '<div style="width:100%;display: inline-block;">';
foreach ($custom_meta_fields as $field) {
$meta = get_post_meta($post->ID, $field['id'], true);
echo '<div style="width:33%;display:inline-block;padding:5px 0px;font:11px tahoma;">
<label for="'.$field['id'].'" style="width:90%;display:inline-block;padding:5px 0px;padding:5px 0px;">'.$field['label'].'</label>
';
switch($field['type']) {
case 'text':
echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" style="width:90%;display:inline-block;font:11px tahoma;box-shadow:none;padding:6px;background:#fafafa;" placeholder="'.$field['label'].'">
<span class="description">'.$field['desc'].'</span>';
break;
// checkbox
case 'checkbox':
echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/>
<label for="'.$field['id'].'">'.$field['desc'].'</label>';
break;
// textarea
case 'textarea':
echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" style="width:90%;font:11px tahoma;resize:none;box-shadow:none;background:#fafafa;">'.$meta.'</textarea>
<br /><span class="description">'.$field['desc'].'</span>';
break;
// select
case 'select':
echo '<select name="'.$field['id'].'" id="'.$field['id'].'" style="font:11px tahoma;">';
foreach ($field['options'] as $option) {
echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';
}
echo '</select><br /><span class="description">'.$field['desc'].'</span>';
break;
}
echo '</div>';
}
echo '</div>';
}
function save_custom_meta($post_id) {
global $custom_meta_fields;
if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))
return $post_id;
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return $post_id;
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id))
return $post_id;
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
foreach ($custom_meta_fields as $field) {
$old = get_post_meta($post_id, $field['id'], true);
$new = $_POST[$field['id']];
if ($new && $new != $old) {
update_post_meta($post_id, $field['id'], $new);
} elseif ('' == $new && $old) {
delete_post_meta($post_id, $field['id'], $old);
}
}
}
add_action('save_post', 'save_custom_meta');
// avatar alt & title
function replace_content($text)
{
$alt = get_the_author_meta( 'display_name' );
$text = str_replace('alt=''', 'alt=''.$alt.'' title=''.$alt.''',$text);
return $text;
}
add_filter('get_avatar','replace_content');
my comment.php:
<?php
/**
* The template for displaying Comments
*
* The area of the page that contains comments and the comment form.
*
*
*/
/*
* If the current post is protected by a password and the visitor has not yet
* entered the password we will return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
?>
<div class="comments" style="margin-top: -50px;">
<?php
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
'textarea' => '<p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p>',
'author' => '<div class="comment-fields"><input id="author" name="author" type="text" placeholder="نام شما (الزامی)" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . '>',
'email' => '<input id="email" name="email" type="text" placeholder="ایمیل شما (الزامی)" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . '>',
'url' => '<input id="url" name="url" type="text" placeholder="سایت شما" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></div>',
'add' => '
',
);
comment_form( array(
'fields' => apply_filters( 'comment_form_default_fields', $fields ),
'must_log_in' => '<p class="must-log-in">' . sprintf('شما باید <a href="%s">وارد شوید</a> تا نظر بنویسید.' , wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'logged_in_as' => '<p class="logged-in-as">' . sprintf('وارد شده به عنوان <a href="%1$s">%2$s</a>. <a href="%3$s" title="خروج از این حساب">خروج؟</a>', admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'comment_notes_before' => '',
'comment_notes_after' => '',
'title_reply' => '' ,
'title_reply_to' => 'پاسخ به %s' ,
'cancel_reply_link' => 'انصراف' ,
'label_submit' => 'ارسال نظر'
));
?>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<?php endif; // Check for comment navigation. ?>
<?php if ( have_comments() ) : ?>
<div class="comment depth-1 col">
<?php $comments_by_type = &separate_comments($comments); ?>
<?php if ( !empty($comments_by_type['comment']) ) : ?>
<?php wp_list_comments('callback=myfamo_comment&style=div'); ?>
<div class="navigation">
<span class="previous_comments"><?php previous_comments_link('نظرات قدیمی') ?></span>
<span class="next_comments"><?php next_comments_link('نظرات جدید') ?></span>
</div></div>
<?php endif; // have_comments() ?>
<?php endif; ?>
<?php if ( ! comments_open() ) : ?>
<psubmit>نظرات بسته شده است.</p>
<?php endif; ?>
</div>
Read more here: Can’t send comment on wordpress