php - CSS loading as empty file in Custom Theme

admin2025-01-07  4

Hello I made a custom theme and moved it from MAMP to a cloud server. For some reason the CSS is an empty file. File path is correct, checked the file in cPanel and it has the full .css sheet. But when I go to console and follow the path it is just empty. My .js file loads fine and I beleive i enqueued the paths properly.

Any help is greatly appreciated and thank you for your time!

Functions

<?php

function paramo_script_enqueue() {

    wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/paramo.css'), array (), '1.0.0', all );
    wp_enqueue_script('customjs', get_template_directory_uri() . '/js/paramo.js', array('jquery', 'jquery-ui-core'), '1.0.0', true );

}

add_action('wp_enqueue_scripts', 'paramo_script_enqueue');
function paramo_theme_setup() {

    add_theme_support('menus');

    register_nav_menu('primary', 'Primary Header Navigation');
    register_nav_menu('secondary', 'Footer Navigation');


}

add_action('init', 'paramo_theme_setup');

add_theme_support('custom-header');


//enqueues our locally supplied font awesome stylesheet
function enqueue_our_required_stylesheets(){
    wp_enqueue_style('font-awesome', get_stylesheet_directory_uri() . '/css/font-awesome.css'); 
}
add_action('wp_enqueue_scripts','enqueue_our_required_stylesheets');


?>

Hello I made a custom theme and moved it from MAMP to a cloud server. For some reason the CSS is an empty file. File path is correct, checked the file in cPanel and it has the full .css sheet. But when I go to console and follow the path it is just empty. My .js file loads fine and I beleive i enqueued the paths properly.

Any help is greatly appreciated and thank you for your time!

Functions

<?php

function paramo_script_enqueue() {

    wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/paramo.css'), array (), '1.0.0', all );
    wp_enqueue_script('customjs', get_template_directory_uri() . '/js/paramo.js', array('jquery', 'jquery-ui-core'), '1.0.0', true );

}

add_action('wp_enqueue_scripts', 'paramo_script_enqueue');
function paramo_theme_setup() {

    add_theme_support('menus');

    register_nav_menu('primary', 'Primary Header Navigation');
    register_nav_menu('secondary', 'Footer Navigation');


}

add_action('init', 'paramo_theme_setup');

add_theme_support('custom-header');


//enqueues our locally supplied font awesome stylesheet
function enqueue_our_required_stylesheets(){
    wp_enqueue_style('font-awesome', get_stylesheet_directory_uri() . '/css/font-awesome.css'); 
}
add_action('wp_enqueue_scripts','enqueue_our_required_stylesheets');


?>

Share Improve this question edited Nov 6, 2017 at 1:52 Tony Garand asked Nov 6, 2017 at 1:06 Tony GarandTony Garand 151 silver badge8 bronze badges 4
  • the file "ParamoGaleria/css/paramo.css" is not empty. It returns a 404 error then it is certainly not uploaded on the server. – mmm Commented Nov 6, 2017 at 1:20
  • It is uploaded though. I updated the last photo of the cPanel. – Tony Garand Commented Nov 6, 2017 at 1:52
  • are you also loading style.css somewhere else? – David Lee Commented Nov 6, 2017 at 2:24
  • Can you solved your problem??? – Vüsal Hüseynli Commented Dec 25, 2020 at 13:23
Add a comment  | 

2 Answers 2

Reset to default 0

This looks like an issue of "File Permission" to me. Please check the file permissions on the involved folders and files.

You should find an option to change permission on the top bar or by right-clicking in cpanel. On the other hand, you can also right-click on a folder or a file and change its permission via Filezilla.

The ideal value is 755 or 750 for directories and 644 or 640 for files. Read more here the codex page

Hope this helps. Regards

Your paramo_script_enqueue() function has a simple syntax error. The wp_enqueue_style() function call has an add closing parenthesis before and a missing opening parenthesis around the dependencies parameter

issue in '/css/paramo.css') and all without parenthesis

replace

wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/paramo.css'), array (), '1.0.0', all );

to

wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/paramo.css', array (), '1.0.0', 'all' );

Visit Wordpress Doc - wp_enqueue_style()

function paramo_script_enqueue() {
    wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/paramo.css', array (), '1.0.0', 'all' );
    wp_enqueue_script('customjs', get_template_directory_uri() . '/js/paramo.js', array('jquery', 'jquery-ui-core'), '1.0.0', true);
}
add_action('wp_enqueue_scripts', 'paramo_script_enqueue');
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736264483a971.html

最新回复(0)