Pregunta

I am creating a new theme, I created a new directory called mytheme and created three files directly inside the directory where the content is as follow:
index.php

<?php echo "hellow world"; ?>

style.css

/*
Theme Name: mytheme
*/
body {background: red;}

functions.php

<?php
wp_enqueue_style( 'style', get_stylesheet_uri() );
?>

the problem: the dashboard is colored in red.
expectations: the website itself to be colored in red.

Edit:
the solution marked is only half the answer.
index.php needs to have headers initiated otherwise it wont work
index.php is now:

<?php
wp_header();
echo "hellow world";
?>
¿Fue útil?

Solución

You need to enqueue your stylesheets and script to wp_enqueue_scripts hook.

In your functions.php try

function enqueue_scripts_cp() {
    wp_enqueue_style( 'style', get_stylesheet_uri() );
} 
add_action( 'wp_enqueue_scripts', 'enqueue_scripts_cp' );
Licenciado bajo: CC-BY-SA con atribución
scroll top