Changeset 357536 for stackwise/1.2.1/functions.php
- Timestamp:
- 11/06/2026 04:58:43 AM (3 days ago)
- Location:
- stackwise/1.2.1
- Files:
-
- 1 edited
- 1 copied
-
. (copied) (copied from stackwise/1.2.0 )
-
functions.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
stackwise/1.2.1/functions.php
r351334 r357536 16 16 * Define theme constants 17 17 */ 18 define( 'STACKWISE_VERSION', '1.2. 0' );18 define( 'STACKWISE_VERSION', '1.2.1' ); 19 19 define( 'STACKWISE_DIR', get_template_directory() ); 20 20 define( 'STACKWISE_URI', get_template_directory_uri() ); … … 46 46 set_post_thumbnail_size( 1200, 750, true ); 47 47 48 // Add custom image sizes. 48 // Add custom image sizes. stackwise-project is used by the Projects section of the Stackwise Companion plugin. 49 49 add_image_size( 'stackwise-project', 800, 500, true ); 50 50 add_image_size( 'stackwise-blog', 600, 400, true ); … … 229 229 ); 230 230 231 // Fallback labels for the toggle button, used if its data attributes are missing. 232 wp_localize_script( 233 'stackwise-theme-toggle', 234 'stackwiseToggle', 235 array( 236 'labelDark' => __( 'Switch to dark mode', 'stackwise' ), 237 'labelLight' => __( 'Switch to light mode', 'stackwise' ), 238 ) 239 ); 240 231 241 // Typing effect (only on front page). 232 242 if ( is_front_page() ) { … … 257 267 258 268 /** 269 * Apply the saved or system light mode before the first paint. 270 * 271 * The theme-toggle.js script loads in the footer, so without this script visitors 272 * who chose light mode would briefly see the dark default. The script is a 273 * fixed string and contains no user data. 274 */ 275 function stackwise_print_theme_mode_script() { 276 wp_print_inline_script_tag( 277 "(function(){try{var t=localStorage.getItem('stackwise-theme');if('light'===t||(!t&&window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches)){document.documentElement.setAttribute('data-theme','light');}}catch(e){}}());" 278 ); 279 } 280 add_action( 'wp_head', 'stackwise_print_theme_mode_script', 1 ); 281 282 /** 259 283 * Get Google Fonts URL 260 284 * … … 280 304 281 305 /** 306 * Default lines for the hero typing effect, one per line. 307 * 308 * @return string Translated default lines separated by new lines. 309 */ 310 function stackwise_get_default_typing_text() { 311 return implode( 312 "\n", 313 array( 314 __( 'Full Stack Developer', 'stackwise' ), 315 __( 'Frontend Engineer', 'stackwise' ), 316 __( 'Backend Developer', 'stackwise' ), 317 __( 'UI/UX Enthusiast', 'stackwise' ), 318 ) 319 ); 320 } 321 322 /** 282 323 * Get typing effect strings from customizer 283 324 * … … 285 326 */ 286 327 function stackwise_get_typing_strings() { 287 $strings = get_theme_mod( 'stackwise_hero_typing_text', "Full Stack Developer\nFrontend Engineer\nBackend Developer\nUI/UX Enthusiast");328 $strings = get_theme_mod( 'stackwise_hero_typing_text', stackwise_get_default_typing_text() ); 288 329 return array_map( 'trim', explode( "\n", $strings ) ); 289 330 } … … 500 541 } 501 542 add_filter( 'excerpt_more', 'stackwise_excerpt_more' ); 502 503 /**504 * Enqueue block editor assets505 */506 function stackwise_block_editor_assets() {507 wp_enqueue_style(508 'stackwise-editor-style',509 STACKWISE_URI . '/assets/css/editor-style.css',510 array(),511 STACKWISE_VERSION512 );513 }514 add_action( 'enqueue_block_editor_assets', 'stackwise_block_editor_assets' );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)