رفتن به مطلب

راهنمایی برای حذف امکان لینک گذاشتن داخل کامنت


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');

 

لینک به ارسال
در 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 قالبت رو ادیت کن قسمت مربوط به لینک رو حذف کن

اگه نمیتونی کدهاشو بزار کمکت کنم

لینک به ارسال
در 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-->

 

لینک به ارسال

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

add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;
}

 

لینک به ارسال
در 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;
}

ویرایش شده توسط kasra.radfar
لینک به ارسال

 

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;
}

 

لینک به ارسال

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

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

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

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

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

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

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

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

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