文件操作 - card-functions.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/Total/inc/cards/card-functions.php
编辑文件内容
<?php defined( 'ABSPATH' ) || exit; /** * Returns array of default card styles. */ function wpex_get_default_card_styles(): array { $card_styles = [ 'button' => [ 'name' => esc_html__( 'Button', 'total' ), ], 'link' => [ 'name' => esc_html__( 'Simple Link', 'total' ), ], ]; $card_categories = [ 'title' => [ 'name' => esc_html__( 'Title', 'total' ), ], 'post-content' => [ 'name' => esc_html__( 'Post Content', 'total' ), ], 'image' => [ 'name' => esc_html__( 'Image', 'total' ), ], 'video' => [ 'name' => esc_html__( 'Video', 'total' ), ], 'toggle' => [ 'name' => esc_html__( 'Toggle', 'total' ), 'count' => 2, ], 'simple' => [ 'name' => esc_html__( 'Simple', 'total' ), 'count' => 9, ], 'news' => [ 'name' => esc_html__( 'News', 'total' ), 'count' => 6, ], 'blog' => [ 'name' => esc_html__( 'Blog', 'total' ), 'count' => 22, ], 'blog-list' => [ 'name' => esc_html__( 'Blog List', 'total' ), 'count' => 22, ], 'magazine' => [ 'name' => esc_html__( 'Magazine', 'total' ), 'count' => 2, ], 'magazine-list' => [ 'name' => esc_html__( 'Magazine List', 'total' ), 'count' => 2, ], 'numbered-list' => [ 'name' => esc_html__( 'Numbered List', 'total' ), 'count' => 6, ], 'overlay' => [ 'name' => esc_html__( 'Overlay', 'total' ), 'count' => 14, ], 'testimonial' => [ 'name' => esc_html__( 'Testimonial', 'total' ), 'count' => 9, ], 'staff' => [ 'name' => esc_html__( 'Staff', 'total' ), 'count' => 8, ], 'portfolio' => [ 'name' => esc_html__( 'Portfolio', 'total' ), 'count' => 6, ], 'product' => [ 'name' => esc_html__( 'Product', 'total' ), 'count' => 4, ], 'search' => [ 'name' => esc_html__( 'Search', 'total' ), 'count' => 6, ], 'icon-box' => [ 'name' => esc_html__( 'Icon Box', 'total' ), 'count' => 6, ], ]; if ( totaltheme_is_integration_active( 'just_events' ) ) { $card_categories['just-events'] = [ 'name' => esc_html__( 'Just Events', 'total' ), 'count' => 2, ]; } foreach ( $card_categories as $key => $val ) { $count = $val['count'] ?? 1; $x = 1; while ( $x <= $count ) { if ( 1 === $count ) { $name = $val['name']; } else { $name = "{$val['name']} {$x}"; } $card_styles[ sanitize_key( "{$key}_{$x}" ) ] = [ 'name' => $name, ]; $x++; } } if ( totaltheme_is_integration_active( 'woocommerce' ) ) { $card_styles['woocommerce'] = [ 'name' => 'WooCommerce', ]; } return $card_styles; } /** * Returns array of card styles. */ function wpex_get_card_styles(): array { static $card_styles = null; if ( is_null( $card_styles ) ) { /** * Checks if default cards are enabled. * * @param bool $check */ $default_cards_enabled = (bool) apply_filters( 'wpex_has_default_card_styles', true ); if ( $default_cards_enabled ) { $card_styles = wpex_get_default_card_styles(); } /** * Filters the theme card styles list. * * @param array $card_styles */ $card_styles = apply_filters( 'wpex_card_styles', $card_styles ); } return (array) $card_styles; } /** * Return an array of card styles. */ function wpex_choices_card_styles(): array { $choices = [ '' => '– ' . esc_html__( 'None', 'total' ) . ' –', ]; foreach ( wpex_get_card_styles() as $k => $v ) { $choices[ $k ] = $v['name']; } return $choices; } /** * Return dropdown select of card styles. */ function wpex_card_select( $args = [] ) { $defaults = [ 'name' => 'card_style', 'selected' => '', 'id' => 'wpex_card_style', 'class' => 'wpex-card-select', 'label' => 0, ]; $parsed_args = wp_parse_args( $args, $defaults ); $select = ''; if ( $parsed_args['label'] ) { $select .= '<label for="' . esc_attr( $parsed_args['name'] ) . '">' . esc_html__( 'Select a card', 'total' ) . ':</label>'; } $select .= '<select name="' . esc_attr( $parsed_args['name'] ) . '"'; if ( $parsed_args['id'] ) { $select .= ' id="' . esc_attr( $parsed_args['id'] ) . '"'; } if ( $parsed_args['class'] ) { $select .= ' class="' . esc_attr( $parsed_args['class'] ) . '"'; } $select .= '>'; foreach ( wpex_choices_card_styles() as $name => $label ) { $select .= '<option value="' . esc_attr( $name ) . '" ' . selected( $name, $parsed_args['selected'], false ) . '>' . esc_html( $label ) . '</option>'; } $select .= '</select>'; return $select; } /** * Display card. */ function wpex_card( $args = [] ) { echo wpex_get_card( $args ); } /** * Get card. */ function wpex_get_card( $args = [] ) { if ( class_exists( 'WPEX_Card' ) ) { return (new WPEX_Card( $args ))->render(); } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件