• Resolved mehran5300

    (@mehran5300)


    hi
    i am trying to make theme and i used html template but when i try to enqueu my stylesheet to wordpress theme its not working
    This the header of theme

    
    <!DOCTYPE html>
    <html dir="ltr" lang="en-US">
    
    <head>
    
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    
      <meta name="viewport" content="width=device-width, initial-scale=1" />
    
      <!-- Document Title
    	============================================= -->
      <title>Index Template</title>
      <!-- <link rel="stylesheet" href="" type="text/css" /> -->
      <?php wp_head(); ?>
    
    </head>
    

    This is the function for enqueue my style sheet.

    
    <?php
    
    // include(get_theme_file_path( '/include/front/enqueue.php' ));
    
    function ft_loadScripts()
    {
        // wp_register_style( 'ft_style', get_stylesheet_uri() );
        // wp_enqueue_style( 'ft_style' );
        wp_enqueue_style( 'ft_style', get_stylesheet_uri() );
    }
    
    add_action( 'wp_enqueue_scripts','ft_loadScripts' );
    
    

    This is my Style sheet whict i want to use in my theme

    
    /*
    Theme Name: Firstweb
    Theme URI: https://wordpress.org/themes/Firstweb/
    Author: Mehran Ali
    Author URI: https://wordpress.org/
    Description: Our default theme for 2020 is designed to take full advantage of the flexibility of the block editor. Organizations and businesses have the ability to create dynamic landing pages with endless layouts using the group and column blocks. The centered content column and fine-tuned typography also makes it perfect for traditional blogs. Complete editor styles give you a good idea of what your content will look like, even before you publish. You can give your site a personal touch by changing the background colors and the accent color in the Customizer. The colors of all elements on your site are automatically calculated based on the colors you pick, ensuring a high, accessible color contrast for your visitors.
    Version: 1.0
    License: GNU General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Text Domain: Firstweb
    */
    
    body{
        background-color: black;
    }
    
    

    it look fine but not working at all plz help me with this
    Thank You in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • the header will be look like this:

    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
        <head>
            <meta charset="<?php bloginfo( 'charset' ); ?>" />
            <title><?php wp_title(); ?></title>
            <link rel="profile" href="http://gmpg.org/xfn/11" />
            <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
            <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
            <?php wp_head(); ?>
        </head>

    reference: Theme Development

    the stylesheet will be look like this:

    function themeslug_enqueue_style() {
        wp_enqueue_style( 'my-theme', 'style.css', false );
    }
     
    function themeslug_enqueue_script() {
        wp_enqueue_script( 'my-js', 'filename.js', false );
    }
     
    add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_style' );
    add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' );

    hope your problem will be solve.
    thanks.

    Thread Starter mehran5300

    (@mehran5300)

    @devecity i try this cvode but its still not working

    Thread Starter mehran5300

    (@mehran5300)

    Actully in my folder structure i use function.php and now replace it with functions.php and is working fine
    thank you

    happy to know your problem is solved.

    thanks,
    DeveCity

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_enqueue_style is not working’ is closed to new replies.