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