我是PHP的新手,我购买了一个主题,我需要自定义注册表。默认情况下,这些字段都是必需的,唯一的方法是自定义。如何将"必需"类替换为可选类?最后,如果我还可以将 URL 输入更改为文件上传(csv 提要和徽标)。提前感谢伙计们
<form class="register-store">
<div class="row">
<div class="col-md-6">
<div class="input-group">
<label for="store_name"><?php esc_attr_e( 'Store Name', 'compare' ) ?> <span class="required">*</span></label>
<input type="text" class="form-control" name="store_name" id="store_name">
<p class="field-description"><?php _e( 'Input name of your store', 'compare' ) ?></p>
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<label for="store_url"><?php esc_attr_e( 'Store URL', 'compare' ) ?> <span class="required">*</span></label>
<input type="text" class="form-control" name="store_url" id="store_url">
<p class="field-description"><?php _e( 'Input link to your store', 'compare' ) ?></p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="input-group">
<label for="store_contact_name"><?php esc_attr_e( 'Your Name', 'compare' ) ?> <span class="required">*</span></label>
<input type="text" class="form-control" name="store_contact_name" id="store_contact_name">
<p class="field-description"><?php _e( 'Input your full name', 'compare' ) ?></p>
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<label for="store_contact_phone"><?php esc_attr_e( 'Your Phone', 'compare' ) ?> <span class="required">*</span></label>
<input type="text" class="form-control" name="store_contact_phone" id="store_contact_phone">
<p class="field-description"><?php _e( 'Input your phone with internation prefix', 'compare' ) ?></p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="input-group">
<label for="store_contact_email"><?php esc_attr_e( 'Your Email', 'compare' ) ?> <span class="required">*</span></label>
<input type="text" class="form-control" name="store_contact_email" id="store_contact_email">
<p class="field-description"><?php _e( 'Input your mail for contact', 'compare' ) ?></p>
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<label for="store_package"><?php esc_attr_e( 'Chose your package', 'compare' ) ?> <span class="required">*</span>
<?php
$all_packages_link = compare_get_permalink_by_tpl( 'page-tpl_packages' );
if( $all_packages_link !== 'javascript:;' ):
?>
<a href="<?php echo esc_url( $all_packages_link ) ?>" class="pull-right"> <?php _e( 'Check list of available packages', 'compare' ) ?></a></label>
<?php endif; ?>
<select name="store_package" id="store_package" class="form-control">
<option value=""><?php _e( 'Select Package', 'compare' ) ?></option>
<?php echo compare_list_packages(); ?>
</select>
<p class="field-description"><?php _e( 'Select package for your store', 'compare' ) ?></p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="input-group">
<label for="store_xml_feed"><?php esc_attr_e( 'Store Feed URL', 'compare' ) ?> <span class="required">*</span></label>
<input type="text" class="form-control" name="store_xml_feed" id="store_xml_feed">
<p class="field-description"><?php _e( 'Input link to your XML / CSV products feed', 'compare' ) ?></p>
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<label for="store_logo"><?php esc_attr_e( 'Store Logo URL', 'compare' ) ?> <span class="required">*</span></label>
<input type="text" class="form-control" name="store_logo" id="store_logo">
<p class="field-description"><?php _e( 'Input link to your store logo', 'compare' ) ?></p>
</div>
根据您购买的模板的设计方式,您应该能够删除<span class="required">*</span>
。 此时,输入字段应处于默认状态,这将允许用户输入(或不输入)信息。 此外,要完成文件上传,请将<input type="">
更改为"文件"
当您看到它只影响窗体的呈现<span class="required">*</span>
时,它不包含数据控件。数据控制是在服务器端进行的,这意味着您必须深入研究 PHP 代码以删除对要设置可选字段的检查。告诉我们您使用什么CMS,也许是WordPress?我会相应地更新我的答案。还与我们分享您购买的主题名称。