0
votes

i have recently download a theme and try to convert it into wordpress theme.

now i got stuck in error i am trying to enqueue my style sheet script into theme and its not working.

this is my header where i use wp_head() tag to hook my enqueue function

<!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 my load style sheet function code and add_action function is use to hook the function to header

function ft_loadScripts()
{
    wp_register_style( 'ft_style', get_stylesheet_uri() );
    wp_enqueue_style( 'ft_style' );
}

add_action( 'wp_enqueue_scripts','ft_loadScripts' );

This is my main style sheet created for theme it is loacated in theme folder
in this style sheet i use only body backgound color to test the code .

/*
Theme Name: Firstweb
Theme URI: https://wordpress.org/themes/Firstweb/
Author:John don
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;
}

This my folder structure

enter image description here

In assets folder

enter image description here

This is how my theme look like

enter image description here

but i don't know why its not working. i also check in developer tool there is no error of style sheet in console but still the style sheet in not working at all

somebody plz help me with this Thank You in advance

1
Welcome to Stack Overflow. Please see How to Ask - images of code are not allowed, you question must include the code itself. You can edit your question to include more information, but in this case the problem is that you're not telling it what stylesheet to load. Please review the documentation for enqueueing stylesheets to see what you need to do. - FluffyKitten
Could you include the HTML Wordpress outputs as well as an overview of the folder structure? I can’t find any fault in the code you provided and it works perfectly for me when trying to reproduce the problem. - FMJansen
@FMJansen i edit my question and add folder structure and browser overview - MEHRAN ALI
The problem is still the same as I said in my comment - you are not including the stylesheet to be loaded! - FluffyKitten
@FluffyKitten actully i am new in wordpress i really didn't get what you are trying to say. So sorry for that can you give any example or can be more elaborate it - MEHRAN ALI

1 Answers

0
votes

From what I can see, the code snippets should all work fine. However, it looks like your functions.php is called function.php (without the ‘s’), causing Wordpress to ignore the file. Hopefully renaming the file fixes your issue!