| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Twenty Twenty-Five functions and definitions. 4 * 5 * @link https://developer.wordpress.org/themes/basics/theme-functions/ 6 * 7 * @package WordPress 8 * @subpackage Twenty_Twenty_Five 9 * @since Twenty Twenty-Five 1.0 10 */ 11 12 if ( ! function_exists( 'twentytwentyfive_post_format_setup' ) ) : 13 /** 14 * Adds theme support for post formats. 15 * 16 * @since Twenty Twenty-Five 1.0 17 * 18 * @return void 19 */ 20 function twentytwentyfive_post_format_setup() { 21 add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) ); 22 } 23 endif; 24 add_action( 'after_setup_theme', 'twentytwentyfive_post_format_setup' ); 25 26 if ( ! function_exists( 'twentytwentyfive_editor_style' ) ) : 27 /** 28 * Enqueues editor-style.css in the editors. 29 * 30 * @since Twenty Twenty-Five 1.0 31 * 32 * @return void 33 */ 34 function twentytwentyfive_editor_style() { 35 add_editor_style( 'assets/css/editor-style.css' ); 36 } 37 endif; 38 add_action( 'after_setup_theme', 'twentytwentyfive_editor_style' ); 39 40 if ( ! function_exists( 'twentytwentyfive_enqueue_styles' ) ) : 41 /** 42 * Enqueues the theme stylesheet on the front. 43 * 44 * @since Twenty Twenty-Five 1.0 45 * 46 * @return void 47 */ 48 function twentytwentyfive_enqueue_styles() { 49 $suffix = SCRIPT_DEBUG ? '' : '.min'; 50 $src = 'style' . $suffix . '.css'; 51 52 wp_enqueue_style( 53 'twentytwentyfive-style', 54 get_parent_theme_file_uri( $src ), 55 array(), 56 wp_get_theme()->get( 'Version' ) 57 ); 58 wp_style_add_data( 59 'twentytwentyfive-style', 60 'path', 61 get_parent_theme_file_path( $src ) 62 ); 63 } 64 endif; 65 add_action( 'wp_enqueue_scripts', 'twentytwentyfive_enqueue_styles' ); 66 67 if ( ! function_exists( 'twentytwentyfive_block_styles' ) ) : 68 /** 69 * Registers custom block styles. 70 * 71 * @since Twenty Twenty-Five 1.0 72 * 73 * @return void 74 */ 75 function twentytwentyfive_block_styles() { 76 register_block_style( 77 'core/list', 78 array( 79 'name' => 'checkmark-list', 80 'label' => __( 'Checkmark', 'twentytwentyfive' ), 81 'inline_style' => ' 82 ul.is-style-checkmark-list { 83 list-style-type: "\2713"; 84 } 85 86 ul.is-style-checkmark-list li { 87 padding-inline-start: 1ch; 88 }', 89 ) 90 ); 91 } 92 endif; 93 add_action( 'init', 'twentytwentyfive_block_styles' ); 94 95 if ( ! function_exists( 'twentytwentyfive_pattern_categories' ) ) : 96 /** 97 * Registers pattern categories. 98 * 99 * @since Twenty Twenty-Five 1.0 100 * 101 * @return void 102 */ 103 function twentytwentyfive_pattern_categories() { 104 105 register_block_pattern_category( 106 'twentytwentyfive_page', 107 array( 108 'label' => __( 'Pages', 'twentytwentyfive' ), 109 'description' => __( 'A collection of full page layouts.', 'twentytwentyfive' ), 110 ) 111 ); 112 113 register_block_pattern_category( 114 'twentytwentyfive_post-format', 115 array( 116 'label' => __( 'Post formats', 'twentytwentyfive' ), 117 'description' => __( 'A collection of post format patterns.', 'twentytwentyfive' ), 118 ) 119 ); 120 } 121 endif; 122 add_action( 'init', 'twentytwentyfive_pattern_categories' ); 123 124 if ( ! function_exists( 'twentytwentyfive_register_block_bindings' ) ) : 125 /** 126 * Registers the post format block binding source. 127 * 128 * @since Twenty Twenty-Five 1.0 129 * 130 * @return void 131 */ 132 function twentytwentyfive_register_block_bindings() { 133 register_block_bindings_source( 134 'twentytwentyfive/format', 135 array( 136 'label' => _x( 'Post format name', 'Label for the block binding placeholder in the editor', 'twentytwentyfive' ), 137 'get_value_callback' => 'twentytwentyfive_format_binding', 138 ) 139 ); 140 } 141 endif; 142 add_action( 'init', 'twentytwentyfive_register_block_bindings' ); 143 144 if ( ! function_exists( 'twentytwentyfive_format_binding' ) ) : 145 /** 146 * Callback function for the post format name block binding source. 147 * 148 * @since Twenty Twenty-Five 1.0 149 * 150 * @return string|void Post format name, or nothing if the format is 'standard'. 151 */ 152 function twentytwentyfive_format_binding() { 153 $post_format_slug = get_post_format(); 154 155 if ( $post_format_slug && 'standard' !== $post_format_slug ) { 156 return get_post_format_string( $post_format_slug ); 157 } 158 } 159 endif;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Apr 21 08:20:12 2026 | Cross-referenced by PHPXref |