Make WordPress Themes


Ignore:
Timestamp:
11/06/2026 04:58:43 AM (3 days ago)
Author:
themedropbox
Message:

New version of Stackwise - 1.2.1

Location:
stackwise/1.2.1
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stackwise/1.2.1/functions.php

    r351334 r357536  
    1616 * Define theme constants
    1717 */
    18 define( 'STACKWISE_VERSION', '1.2.0' );
     18define( 'STACKWISE_VERSION', '1.2.1' );
    1919define( 'STACKWISE_DIR', get_template_directory() );
    2020define( 'STACKWISE_URI', get_template_directory_uri() );
    … …  
    4646        set_post_thumbnail_size( 1200, 750, true );
    4747
    48         // Add custom image sizes.
     48        // Add custom image sizes. stackwise-project is used by the Projects section of the Stackwise Companion plugin.
    4949        add_image_size( 'stackwise-project', 800, 500, true );
    5050        add_image_size( 'stackwise-blog', 600, 400, true );
    … …  
    229229        );
    230230
     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
    231241        // Typing effect (only on front page).
    232242        if ( is_front_page() ) {
    … …  
    257267
    258268/**
     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 */
     275function 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}
     280add_action( 'wp_head', 'stackwise_print_theme_mode_script', 1 );
     281
     282/**
    259283 * Get Google Fonts URL
    260284 *
    … …  
    280304
    281305/**
     306 * Default lines for the hero typing effect, one per line.
     307 *
     308 * @return string Translated default lines separated by new lines.
     309 */
     310function 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/**
    282323 * Get typing effect strings from customizer
    283324 *
    … …  
    285326 */
    286327function 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() );
    288329        return array_map( 'trim', explode( "\n", $strings ) );
    289330}
    … …  
    500541}
    501542add_filter( 'excerpt_more', 'stackwise_excerpt_more' );
    502 
    503 /**
    504  * Enqueue block editor assets
    505  */
    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_VERSION
    512         );
    513 }
    514 add_action( 'enqueue_block_editor_assets', 'stackwise_block_editor_assets' );
Note: See TracChangeset for help on using the changeset viewer.