Tuesday, July 19, 2022
HomeWordPress Developmentlittle one theme - Syntax Error inside features.php file

little one theme – Syntax Error inside features.php file


In creating a baby theme features.php file, WP dislikes the code on line 86 (particularly, the very backside curly bracket).

I used kaleidoscope for file comparability and grabbed this part of code. It’s equivalent (copy/paste) to what exists in a working (mirror) website’s features.php file (that has no little one theme).

I added code on the high of the file to activate the kid theme perform (it might not permit me to put up the code right here for some motive). Can I get a suggestion for the kid theme features.php code – that could be the error I can not determine.

After I activate the kid theme I get a deadly WP error. What am I doing incorrect?

Here is the features.php file coding (this put up doesn’t present the <?php add half (see above) on the high of the file code for some motive):

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
perform enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/model.css' );
}
?>

        // Add types inline.
        wp_add_inline_style( 'twentytwentytwo-style', twentytwentytwo_get_font_face_styles() );


if ( ! function_exists( 'twentytwentytwo_editor_styles' ) ) :

    /**
     * Enqueue editor types.
     *
     * @since Twenty Twenty-Two 1.0
     *
     * @return void
     */
    perform twentytwentytwo_editor_styles() {

        // Add types inline.
        wp_add_inline_style( 'wp-block-library', twentytwentytwo_get_font_face_styles() );

    }

endif;

add_action( 'admin_init', 'twentytwentytwo_editor_styles' );


if ( ! function_exists( 'twentytwentytwo_get_font_face_styles' ) ) :

    /**
     * Get font face types.
     * Referred to as by features twentytwentytwo_styles() and twentytwentytwo_editor_styles() above.
     *
     * @since Twenty Twenty-Two 1.0
     *
     * @return string
     */
    perform twentytwentytwo_get_font_face_styles() {

        return "
        @font-face{
            font-family: 'Supply Serif Professional';
            font-weight: 200 900;
            font-style: regular;
            font-stretch: regular;
            font-display: swap;
            src: url('" . get_theme_file_uri( 'property/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) . "') format('woff2');
        }

        @font-face{
            font-family: 'Supply Serif Professional';
            font-weight: 200 900;
            font-style: italic;
            font-stretch: regular;
            font-display: swap;
            src: url('" . get_theme_file_uri( 'property/fonts/SourceSerif4Variable-Italic.ttf.woff2' ) . "') format('woff2');
        }
        ";

    }

endif;

if ( ! function_exists( 'twentytwentytwo_preload_webfonts' ) ) :

    /**
     * Preloads the principle net font to enhance efficiency.
     *
     * Solely the principle net font (font-style: regular) is preloaded right here since that font is at all times related (it's used
     * on each heading, for instance). The opposite font is just wanted if there may be any relevant content material in italic model,
     * and due to this fact preloading it might usually regress efficiency when that font would in any other case not be loaded
     * in any respect.
     *
     * @since Twenty Twenty-Two 1.0
     *
     * @return void
     */
    perform twentytwentytwo_preload_webfonts() {
        ?>
        <hyperlink rel="preload" href="<?php echo esc_url( get_theme_file_uri( 'property/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) ); ?>" as="font" kind="font/woff2" crossorigin>
        <?php
    }

endif;

add_action( 'wp_head', 'twentytwentytwo_preload_webfonts' );

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments