月度归档: 2022 年 6 月

  • 宝塔面板2022年 618特惠活动

    宝塔面板2022年 618特惠活动

    目前,我们的服务器采用的WEB环境较多的会用到宝塔面板,当然我们也知道专业版和企业版权限是比较大的,功能上也比较多。如果我们有需要用到专业版和企业版的,可以在618期间选择有折扣活动。如果我们准备长期用的建议可以选择永久授权。

    618特惠活动于本月15日正式开启,企业版899元/年(送2张商业SSL证书),专业版永久授权1988元起,最高立减4700元。

    宝塔2022年618特惠活动直达链接:https://www.jiloc.com/go/bt

    活动一:购买企业版,赠送SSL证书

    1台企业版宝塔面板(Linux/Windows)优惠价只要899元/年,还会赠送2张商业SSL证书,企业版包含专业版插件以及企业版插件;1台宝塔Linux专业版活动价449元/年,1台宝塔Windows专业版活动价649元/年,包含免费版所有功能、Web应用防火墙、网站监控报表等。

    活动二:永久版授权1988元起

    活动规则

    活动一规则

    1、*购买后可在面板上直接通过抵扣券续费订单。

    2、企业版已包含QQ或微信客服,能更好的保障您的服务,如需加群,请购买企业版,微信扫描右下角二维码咨询。

    3、企业版包含专业版插件以及企业版插件,不含第三方应用插件。

    4、活动产品不参与返现。

    5、活动产品,不支持退款。可开发票,微信扫描右下角二维码咨询。

    6、活动截止日期:2022年6月18日 23:59:59。

    活动二规则

    1、*购买后可在面板上直接通过抵扣券续费订单。

    2、Linux/windows专业版为永久授权套餐。

    3、活动产品不参与返现。

    4、活动产品,不支持退款。可开发票,微信扫描右下角二维码咨询。

    5、活动截止日期:2022年6月18日 23:59:59。

  • WooCommerce创建各种表单 woocommerce_form_field() 函数 代码调用实例

    WooCommerce创建各种表单 woocommerce_form_field() 函数 代码调用实例

    woocommerce_form_field() 是用来创建WooCommerce里各种表单元素的函数,本文列举了输出常见元素的代码示例,供参考。

    Text Box / 文本域

    woocommerce_form_field("my_textbox", array(
        'type'     			=> 'text',
        'class'    			=> array('form-row-wide my-textbox'),
        'label'    			=> 'Textbox Field',
        'placeholder' 		=> 'Placehoder text',
        'required'			=> true,
        'default'  			=> ''
    ), $checkout->get_value( 'my_textbox' ) );

    Checkbox / 复选框

    woocommerce_form_field("my_textbox", array(
        'type'     			=> 'checkbox',
        'class'    			=> array('form-row-wide my-checkbox'),
        'label'    			=> 'Checkbox Field',
        'description'		=> 'A short description of this checkbox',
        'default'  			=> ''
    ), $checkout->get_value( 'my_textbox' ) );

    Textarea / 文本域

    woocommerce_form_field("my_textarea", array(
        'type'     			=> 'textarea',
        'class'    			=> array('form-row-wide my-textarea'),
        'label'    			=> 'Textarea Field',
        'custom_attributes' => array( 'rows' => 10, 'cols' => 10 ),
        'default'  			=> ''
    ), $checkout->get_value( 'my_textarea' ) );

    Select / 下拉列表

    woocommerce_form_field("my_select", array(
        'type'     			=> 'select',
        'class'    			=> array('form-row-wide my-select'),
        'label'    			=> 'Dropdown',
        'options'			=> array( '1' => 'Option 1' , '2' => 'Option 2', '3' => 'Option 3' ),
    ), $checkout->get_value( 'my_select' ) );

    Radio / 单选按钮

    woocommerce_form_field("my_radio", array(
        'type'     			=> 'radio',
        'class'    			=> array('form-row-wide my-radio'),
        'label'    			=> 'Radio',
        'label_class'		=> 'radio-box',
        'options'			=> array( '1' => 'Option 1' , '2' => 'Option 2', '3' => 'Option 3' ),
    ), $checkout->get_value( 'my_radio' ) );

    Pasword / 密码域

    woocommerce_form_field("my_textbox", array(
        'type'     			=> 'password',
        'class'    			=> array('form-row-wide my-textbox'),
        'label'    			=> 'Password',
        'placeholder' 		=> '',
        'required'			=> true,
        'default'  			=> ''
    ), $checkout->get_value( 'my_textbox' ) );

    控制分栏

    通过给”class”参数传递适当的值,可以控制表单字段占全宽还是1/2宽度

    form-row-wide: 全宽

    form-row-first: 1/2宽度,第一栏

    form-row-last:1/2宽度,第二栏

    增加清除浮动结构

    要在表单字段后输出<div class="clear"></div>,增加'clear' => true

    创建自定义字段之input type=“hidden”

    WooCommerce的表单API可以增加自定义字段,例如输出如下结构

    <p class="form-row form-row-wide my-hidden-field" id="my_hidden_field_field">
    	<input type="hidden" class="input-text " name="my_hidden_field" id="my_hidden_field" value="">
    </p>

    首先创建产生这个结构的处理代码

    function wc_form_hidden_field( $field, $key, $args, $value ){
    	$defaults = array(
    		'label'             => '',
    		'id'                => $key,
    		'class'             => array(),
    		'input_class'       => array(),
    		'custom_attributes' => array(),
    		'default'           => '',
    	);	
    	$args = wp_parse_args( $args, $defaults );
    	// Custom attribute handling
    	$custom_attributes = array();
    	if ( ! empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) )
    		foreach ( $args['custom_attributes'] as $attribute => $attribute_value )
    			$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
    	$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
    	$field .= '<input type="hidden" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' /></p>';
    	
    	return $field;
    }
    add_filter( 'woocommerce_form_field_hidden', 'wc_form_hidden_field', 10, 4 );

    然后正常调用woocommerce_form_field() 创建隐藏字段,type为hidden

    woocommerce_form_field("my_hidden_field", array(
        'type'     			=> 'hidden',
        'class'    			=> array('form-row-wide my-hidden-field'),
        'label'    			=> 'Hidden Field',
        'placeholder' 		=> '',
        'default'  			=> ''
    ), $checkout->get_value( 'my_hidden_field' ) );
  • WordPress WooCommerce检测某个产品ID Product ID 是否在订单中 代码实例

    WordPress WooCommerce检测某个产品ID Product ID 是否在订单中 代码实例

    在WordPress的主题WooCommerce商城开发插件中,我们需要检测一个产品id是否在某个订单中,下面我们记录一下代码实例

    function check_order_product_id($order_id,$the_product_id)
    {
        $order = wc_get_order((int)$order_id);
        $items = $order->get_items();
        foreach ($items as $item_id => $item) {
            $product_id = $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id();
            if ($product_id === (int)$the_product_id) {
                return true;
            }
        }
        return false;
    }
    
  • 腾讯云QCloud 618超级爆品活动 2022 6.1 ~ 6.14

    腾讯云QCloud 618超级爆品活动 2022 6.1 ~ 6.14

    目前腾讯云618采购季活动已经开始,如果我们有需要采购云服务器、企业云应用的活动力度还是不错的。比如服务器低至年付仅需45元。

    腾讯云QCloud 618超级爆品活动  https://www.jiloc.com/go/qcloud-618party

    限时活动

    6.1-6.14爆品秒杀不间断,爆款腾讯云QCloud云服务器低至¥18元/3月

    买赠福利专区

    买即送 轻量2核4G、最长续3个月

    企业·专区

    热卖云产品·特惠

    CDN&存储、云安全、AI应用、开发服务

    代金券·大礼包

    如果我们有需要新购续费和升级可以领取代金券。

    腾讯云QCloud下一期的活动 6.15 ~ 6.21 Hi购黄金周 ,我们将持续关注。

WeChat