ec0139 0 ارسال شده در فروردین 99 گزارش بازنشر ارسال شده در فروردین 99 برای بستن لینک داخل کامنت ، دو تا کد زیر کار نمیکنن . چطور بدون افزونه امکان لینک گذاشتن کامنت حذف بشه؟ کد اولی داخل فایل کامنت و کد بعدی برای فایل فانکیشن . هیچ کدوم کار نکردن . کاربر برای کامنت گذاشتن بتونه فقط اسم و ایمیل بزاره و لینک حذف بشه add_filter('comment_form_default_fields', 'mw_unset_url_field'); function mw_unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; function author_link(){ global $comment; $comment_ID = $comment->user_id; $author = get_comment_author( $comment_ID ); $url = get_comment_author_url( $comment_ID ); if ( empty( $url ) || 'http://' == $url ) $return = $author; else $return = "$author"; return $return; } add_filter('get_comment_author_link', 'author_link'); لینک به ارسال
kasra.geladiator 72 ارسال شده در فروردین 99 گزارش بازنشر ارسال شده در فروردین 99 در 11 ساعت قبل، ec0139 گفته است : برای بستن لینک داخل کامنت ، دو تا کد زیر کار نمیکنن . چطور بدون افزونه امکان لینک گذاشتن کامنت حذف بشه؟ کد اولی داخل فایل کامنت و کد بعدی برای فایل فانکیشن . هیچ کدوم کار نکردن . کاربر برای کامنت گذاشتن بتونه فقط اسم و ایمیل بزاره و لینک حذف بشه add_filter('comment_form_default_fields', 'mw_unset_url_field'); function mw_unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; function author_link(){ global $comment; $comment_ID = $comment->user_id; $author = get_comment_author( $comment_ID ); $url = get_comment_author_url( $comment_ID ); if ( empty( $url ) || 'http://' == $url ) $return = $author; else $return = "$author"; return $return; } add_filter('get_comment_author_link', 'author_link'); فایل comment.php قالبت رو ادیت کن قسمت مربوط به لینک رو حذف کن اگه نمیتونی کدهاشو بزار کمکت کنم لینک به ارسال
ec0139 0 ارسال شده در فروردین 99 مالک گزارش بازنشر ارسال شده در فروردین 99 در 47 دقیقه قبل، kasra.radfar گفته است : فایل comment.php قالبت رو ادیت کن قسمت مربوط به لینک رو حذف کن اگه نمیتونی کدهاشو بزار کمکت کنم ممنون کد زیر داخل فایل کامنت حذف کردم فرقی نکرد! <div class="ping-link"><?php comment_author_link($comment); ?></div> کد کامل فایل کامنت <?php if ( post_password_required() ) { return; } ?> <section id="comments" class="themeform"> <?php if ( have_comments() ) : global $wp_query; ?> <h3 class="heading"><?php comments_number( __( 'No Responses', 'hueman' ), __( '1 Response', 'hueman' ), __( '% Responses', 'hueman' ) ); ?></h3> <ul class="comment-tabs group"> <li class="active"><a href="#commentlist-container"><i class="far fa-comments"></i><?php _e( 'Comments', 'hueman' ); ?><span><?php echo count($wp_query->comments_by_type['comment']); ?></span></a></li> <li><a href="#pinglist-container"><i class="fas fa-share"></i><?php _e( 'Pingbacks', 'hueman' ); ?><span><?php echo count($wp_query->comments_by_type['pings']); ?></span></a></li> </ul> <?php if ( ! empty( $comments_by_type['comment'] ) ) { ?> <div id="commentlist-container" class="comment-tab"> <ol class="commentlist"> <?php wp_list_comments( sprintf( "avatar_size=%s&type=comment", apply_filters('hu_avatar_size', 48 ) ) ); ?> </ol><!--/.commentlist--> <?php if ( get_comment_pages_count() > 1 && get_option('page_comments') ) : ?> <nav class="comments-nav group"> <div class="nav-previous"><?php previous_comments_link(); ?></div> <div class="nav-next"><?php next_comments_link(); ?></div> </nav><!--/.comments-nav--> <?php endif; ?> </div> <?php } ?> <?php if ( ! empty( $comments_by_type['pings'] ) ) { ?> <div id="pinglist-container" class="comment-tab"> <ol class="pinglist"> <?php // not calling wp_list_comments twice, as it breaks pagination $pings = $comments_by_type['pings']; foreach ($pings as $comment) { ?> <li class="ping"> <div class="ping-link"><?php comment_author_link($comment); ?></div> <div class="ping-meta"><?php comment_date( get_option( 'date_format' ), $comment ); ?></div> <div class="ping-content"><?php comment_text($comment); ?></div> </li> <?php } ?> </ol><!--/.pinglist--> </div> <?php } ?> <?php else: // if there are no comments yet ?> <?php if (comments_open()) : ?> <!-- comments open, no comments --> <?php else : ?> <!-- comments closed, no comments --> <?php endif; ?> <?php endif; ?> <?php if ( comments_open() ) { comment_form(); } ?> </section><!--/#comments--> لینک به ارسال
ec0139 0 ارسال شده در فروردین 99 مالک گزارش بازنشر ارسال شده در فروردین 99 از کد زیر برای بستن لینک گذاشتن داخل کامنت استفاده کردم . کاربر فقط ایمیل و اسم بزاره و لینک نتونه بزاره . کد کار کرد و قسمت لینک حذف شد ولی کسی نمیتونه تایپ کنه کامنت بنویسه! بقیه قسمت های سایت میشه تایپ کرد فقط کامنت کسی نمیتونه بنویسه! مشکل از چی هست و چی کار کنم؟ چندمین کدی هست که تست کردم کار میکنه ولی نمیشه تایپ کرد!! فانکیشن add_filter('comment_form_default_fields', 'unset_url_field'); function unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; } لینک به ارسال
kasra.geladiator 72 ارسال شده در فروردین 99 گزارش بازنشر ارسال شده در فروردین 99 (ویرایش شده) در 16 ساعت قبل، ec0139 گفته است : از کد زیر برای بستن لینک گذاشتن داخل کامنت استفاده کردم . کاربر فقط ایمیل و اسم بزاره و لینک نتونه بزاره . کد کار کرد و قسمت لینک حذف شد ولی کسی نمیتونه تایپ کنه کامنت بنویسه! بقیه قسمت های سایت میشه تایپ کرد فقط کامنت کسی نمیتونه بنویسه! مشکل از چی هست و چی کار کنم؟ چندمین کدی هست که تست کردم کار میکنه ولی نمیشه تایپ کرد!! فانکیشن add_filter('comment_form_default_fields', 'unset_url_field'); function unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; } اینو امتحان کن add_filter('comment_form_default_fields', 'mw_unset_url_field'); function mw_unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; } ویرایش شده فروردین 99 توسط kasra.radfar لینک به ارسال
kasra.geladiator 72 ارسال شده در فروردین 99 گزارش بازنشر ارسال شده در فروردین 99 add_filter('comment_form_default_fields', 'mw_unset_url_field'); function mw_unset_url_field($fields){ if(isset($fields['url'])) unset($fields['url']); return $fields; } لینک به ارسال
پست های پیشنهاد شده
لطفا برای ارسال دیدگاه وارد شوید
شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید
ورود به حساب کاربری