So I attempted to look for a solution: custom wordpress theme: layout images not displaying
It did not work for me.
My directory for my theme is
wp-content/themes/fearnothing/
and consist of these files
/css(folder)
/js (folder)
/images (folder)
header.php
index.php
function.php
footer.php
style.css
hrtbrk.gif
hrtbrk.png
css folder contains
fearnothing.css
js folder is empty
fearnothing.js
My header.php has the following code:
<!DOCTYPE html>
<html>
<head>
<title>example title</title>
<?php wp_head(); ?>
</head>
<body>
<img class ="nightsky" src="wp-content/themes/fearnothing/hrtbrk.png" alt ="3">
functions.php
<?php
function fearnothing_script_enqueue(){
wp_enqueue_style('customstyle', get_template_directory_uri().'/css/fearnothing.css',array(), '1.1.2', 'all');
}
add_action('wp_enqueue_scripts', 'fearnothing_script_enqueue');
fearnothing.css
html,body{
background: black;
color: #8c0707;
font-family: Courier,Courier New,Lucida Sans Typewriter,Lucida Typewriter,monospace;
font-size: 10px;
cursor: pointer;
}
.nightsky{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 500px;
height: 500px;
}
I'm trying to add the gif but it did not work. so I tried an image instead. I tested my code offline with html and it works fine?
EDIT I added a images folder to my theme where the theme would be located.