| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Twenty Twenty-Four functions and definitions 4 * 5 * @link https://developer.wordpress.org/themes/basics/theme-functions/ 6 * 7 * @package Twenty Twenty-Four 8 * @since Twenty Twenty-Four 1.0 9 */ 10 11 if ( ! function_exists( 'twentytwentyfour_block_styles' ) ) : 12 /** 13 * Registers custom block styles. 14 * 15 * @since Twenty Twenty-Four 1.0 16 * @return void 17 */ 18 function twentytwentyfour_block_styles() { 19 20 register_block_style( 21 'core/details', 22 array( 23 'name' => 'arrow-icon-details', 24 'label' => __( 'Arrow icon', 'twentytwentyfour' ), 25 /* 26 * Styles for the custom Arrow icon style of the Details block 27 */ 28 'inline_style' => ' 29 .is-style-arrow-icon-details { 30 padding-top: var(--wp--preset--spacing--10); 31 padding-bottom: var(--wp--preset--spacing--10); 32 } 33 34 .is-style-arrow-icon-details summary { 35 list-style-type: "\2193\00a0\00a0\00a0"; 36 } 37 38 .is-style-arrow-icon-details[open]>summary { 39 list-style-type: "\2192\00a0\00a0\00a0"; 40 }', 41 ) 42 ); 43 register_block_style( 44 'core/post-terms', 45 array( 46 'name' => 'pill', 47 'label' => __( 'Pill', 'twentytwentyfour' ), 48 /* 49 * Styles variation for post terms 50 * https://github.com/WordPress/gutenberg/issues/24956 51 */ 52 'inline_style' => ' 53 .is-style-pill a, 54 .is-style-pill span:not([class], [data-rich-text-placeholder]) { 55 display: inline-block; 56 background-color: var(--wp--preset--color--base-2); 57 padding: 0.375rem 0.875rem; 58 border-radius: var(--wp--preset--spacing--20); 59 } 60 61 .is-style-pill a:hover { 62 background-color: var(--wp--preset--color--contrast-3); 63 }', 64 ) 65 ); 66 register_block_style( 67 'core/list', 68 array( 69 'name' => 'checkmark-list', 70 'label' => __( 'Checkmark', 'twentytwentyfour' ), 71 /* 72 * Styles for the custom checkmark list block style 73 * https://github.com/WordPress/gutenberg/issues/51480 74 */ 75 'inline_style' => ' 76 ul.is-style-checkmark-list { 77 list-style-type: "\2713"; 78 } 79 80 ul.is-style-checkmark-list li { 81 padding-inline-start: 1ch; 82 }', 83 ) 84 ); 85 register_block_style( 86 'core/navigation-link', 87 array( 88 'name' => 'arrow-link', 89 'label' => __( 'With arrow', 'twentytwentyfour' ), 90 /* 91 * Styles for the custom arrow nav link block style 92 */ 93 'inline_style' => ' 94 .is-style-arrow-link .wp-block-navigation-item__label:after { 95 content: "\2197"; 96 padding-inline-start: 0.25rem; 97 vertical-align: middle; 98 text-decoration: none; 99 display: inline-block; 100 }', 101 ) 102 ); 103 register_block_style( 104 'core/heading', 105 array( 106 'name' => 'asterisk', 107 'label' => __( 'With asterisk', 'twentytwentyfour' ), 108 'inline_style' => " 109 .is-style-asterisk:before { 110 content: ''; 111 width: 1.5rem; 112 height: 3rem; 113 background: var(--wp--preset--color--contrast-2, currentColor); 114 clip-path: path('M11.93.684v8.039l5.633-5.633 1.216 1.23-5.66 5.66h8.04v1.737H13.2l5.701 5.701-1.23 1.23-5.742-5.742V21h-1.737v-8.094l-5.77 5.77-1.23-1.217 5.743-5.742H.842V9.98h8.162l-5.701-5.7 1.23-1.231 5.66 5.66V.684h1.737Z'); 115 display: block; 116 } 117 118 /* Hide the asterisk if the heading has no content, to avoid using empty headings to display the asterisk only, which is an A11Y issue */ 119 .is-style-asterisk:empty:before { 120 content: none; 121 } 122 123 .is-style-asterisk:-moz-only-whitespace:before { 124 content: none; 125 } 126 127 .is-style-asterisk.has-text-align-center:before { 128 margin: 0 auto; 129 } 130 131 .is-style-asterisk.has-text-align-right:before { 132 margin-left: auto; 133 } 134 135 .rtl .is-style-asterisk.has-text-align-left:before { 136 margin-right: auto; 137 }", 138 ) 139 ); 140 } 141 endif; 142 143 add_action( 'init', 'twentytwentyfour_block_styles' ); 144 145 if ( ! function_exists( 'twentytwentyfour_block_stylesheets' ) ) : 146 /** 147 * Enqueues custom block stylesheets. 148 * 149 * @since Twenty Twenty-Four 1.0 150 * @return void 151 */ 152 function twentytwentyfour_block_stylesheets() { 153 /** 154 * The wp_enqueue_block_style() function allows us to enqueue a stylesheet 155 * for a specific block. These will only get loaded when the block is rendered 156 * (both in the editor and on the front end), improving performance 157 * and reducing the amount of data requested by visitors. 158 * 159 * See https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/ for more info. 160 */ 161 wp_enqueue_block_style( 162 'core/button', 163 array( 164 'handle' => 'twentytwentyfour-button-style-outline', 165 'src' => get_parent_theme_file_uri( 'assets/css/button-outline.css' ), 166 'ver' => wp_get_theme( get_template() )->get( 'Version' ), 167 'path' => get_parent_theme_file_path( 'assets/css/button-outline.css' ), 168 ) 169 ); 170 } 171 endif; 172 173 add_action( 'init', 'twentytwentyfour_block_stylesheets' ); 174 175 if ( ! function_exists( 'twentytwentyfour_pattern_categories' ) ) : 176 /** 177 * Registers pattern categories. 178 * 179 * @since Twenty Twenty-Four 1.0 180 * @return void 181 */ 182 function twentytwentyfour_pattern_categories() { 183 184 register_block_pattern_category( 185 'twentytwentyfour_page', 186 array( 187 'label' => _x( 'Pages', 'Block pattern category', 'twentytwentyfour' ), 188 'description' => __( 'A collection of full page layouts.', 'twentytwentyfour' ), 189 ) 190 ); 191 } 192 endif; 193 194 add_action( 'init', 'twentytwentyfour_pattern_categories' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Jun 16 08:20:09 2026 | Cross-referenced by PHPXref |