php 评论表格占位符

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 评论表格占位符相关的知识,希望对你有一定的参考价值。

add_filter( 'comment_form_default_fields', __NAMESPACE__ . '\add_comment_placeholders' );
/**
 * Add Placehoder in comment Form Fields (Name, Email, Website)
 *
 * @since 1.0.0
 *
 * @param $fields
 *
 * @return mixed
 */
function add_comment_placeholders( $fields )
{

	$fields['author'] = str_replace(
		'<input',
		'<input placeholder="Name"',
		$fields['author']
	);

	$fields['email'] = str_replace(
		'<input',
		'<input placeholder="Email"',
		$fields['email']
	);

	$fields['url'] = str_replace(
		'<input',
		'<input placeholder="Website"',
		$fields['url']
	);

	return $fields;

}

add_filter( 'comment_form_defaults', __NAMESPACE__ . '\add_textarea_placeholder' );
/**
 * Add Placehoder in comment Form Field
 *
 * @since 1.0.0
 *
 * @param $fields
 *
 * @return mixed
 */
function add_textarea_placeholder( $fields )
{

	$fields['comment_field'] = str_replace(
		'<textarea',
		'<textarea placeholder="Message"',
		$fields['comment_field']
	);


	return $fields;

}
//* Add Placehoder in comment Form Fields (Name, Email, Website)
add_filter( 'comment_form_default_fields', 'studio_comment_placeholders' );
function studio_comment_placeholders( $fields )
{

    $fields['author'] = str_replace(
        '<input',
        '<input placeholder="First name"',
        $fields['author']
    );

    $fields['email'] = str_replace(
        '<input',
        '<input placeholder="Email address"',
        $fields['email']
    );

    $fields['url'] = str_replace(
        '<input',
        '<input placeholder="Website"',
        $fields['url']
    );

    return $fields;

}


//* Add Placehoder in comment Form Field (Comment) 
add_filter( 'comment_form_defaults', 'studio_textarea_placeholder' );
function studio_textarea_placeholder( $fields )
{
  
    $fields['comment_field'] = str_replace(
        '<textarea',
        '<textarea placeholder="Message"',
        $fields['comment_field']
    );
   

    return $fields;

}

以上是关于php 评论表格占位符的主要内容,如果未能解决你的问题,请参考以下文章

powershell 模板powershell函数,占位符解释了Powershell中发生的高级参数绑定。用法:见里面的评论

HTML 表格占位符错误

表格出现之前的QtableView占位符文本

Psycopg2 使用占位符插入表格

将占位符添加到表格视图单元格上的文本字段

javascript 表格占位符