文件操作 - steps.php
返回文件管理
返回主菜单
删除本文件
文件: /var/www/ltlcompare.com/wp-content/themes/ltl-compare/blocks/steps.php
编辑文件内容
<?php use Carbon_Fields\Block; use Carbon_Fields\Field; function ltl_compare_crb_block_steps() { Block::make( 'steps', __( 'Steps', DOMAIN ) ) ->add_fields( array( Field::make( 'block_preview', 'preview', __( 'Preview', DOMAIN ) ) ->set_html('<img src="'. TEMPLATE_URL .'/img/block-steps.webp" alt="">'), Field::make( 'textarea', 'title', __( 'Title', DOMAIN ) ) ->set_rows( 2 ), Field::make( 'textarea', 'desc', __( 'Description', DOMAIN ) ) ->set_rows( 3 ), Field::make( 'complex', 'steps', __( 'Steps', DOMAIN ) ) ->set_collapsed( true ) ->set_layout( 'tabbed-vertical' ) ->add_fields( array( Field::make( 'image', 'icon', __( 'Icon', DOMAIN ) ), Field::make( 'text', 'title', __( 'Title', DOMAIN ) ), Field::make( 'textarea', 'desc', __( 'Description', DOMAIN ) ) ->set_rows( 2 ), ) ) ->set_header_template( '<%= title %>' ), ) ) ->set_description( __( 'Steps', DOMAIN ) ) ->set_keywords( array( __( 'Steps', DOMAIN ), ) ) ->set_category( 'theme_blocks', __( 'Theme blocks', DOMAIN ) ) ->set_render_callback( function ( $fields, $attributes ) { if ( $fields['title'] || ( $fields['desc'] ?? null ) || $fields['steps'] ) : ?> <div class="custom-block section custom-block-steps<?php echo $attributes['className'] ?? null ? ' ' . $attributes['className'] : ''; ?>"> <div class="container"> <?php if ( $fields['title'] || ( $fields['desc'] ?? null ) ) : ?> <div class="section-head"> <?php if ( $fields['title'] ) : ?> <h2 class="section-title"><?php echo $fields['title']; ?></h2> <?php endif; ?> <?php if ( ( $fields['desc'] ?? null ) ) : ?> <div class="section-desc"><?php echo $fields['desc']; ?></div> <?php endif; ?> </div> <?php endif; ?> <?php if ( $fields['steps'] ) : ?> <div class="steps-list"> <?php foreach ( $fields['steps'] as $key => $item ) : ?> <div class="steps-item"> <div class="steps-item-head"> <div class="steps-item-number h3"> <?php echo $key + 1 < 10 ? '0' . $key + 1 : $key + 1 ?> </div> <?php if ( $item['icon'] ) : ?> <div class="steps-item-icon fit-img"> <img src="<?php echo image_downsize( $item['icon'], 'full' )[0]; ?>" alt="<?php echo get_post_meta( $item['icon'], '_wp_attachment_image_alt', true ); ?>" /> </div> <?php endif; ?> </div> <?php if ( $item['title'] ) : ?> <div class="steps-item-title h3"><?php echo $item['title']; ?></div> <?php endif; ?> <?php if ( $item['desc'] ) : ?> <div class="steps-item-desc"><?php echo $item['desc']; ?></div> <?php endif; ?> </div> <?php endforeach; ?> </div> <?php endif; ?> </div> </div> <?php endif; }); } add_action( 'carbon_fields_register_fields', 'ltl_compare_crb_block_steps' );
修改文件时间
将文件时间修改为当前时间的前一年
删除文件