How to link style.css in functions.php

Question

I’m a newbie to WordPress; I just started learning WordPress. I’m trying to link style.css in functions.php but I am unable to achieve what might be the issue here. Can anyone point me the right direction?

index.php

<?php
get_header();
?>


<?php
    if ( have_posts() ) {

        while ( have_posts() ) {
            the_post();
            echo 'Posts are foound';
       }
    } else {
    echo 'No Posts are found';
    }
?>
<div class="inner">
    <?php bloginfo('title'); ?><br>
    <?php bloginfo('description'); ?>
    <?php echo "<h1>Hello world</h1>"; ?>
</div>

<?php
    get_footer();

functions.php

   function mortal_theme() {
  wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css' );
  }
   add_action( 'wp_enqueue_scripts', 'mortal_theme' );

style.css

 h1 {
   background-color: red;
   color: yellow;
   font-size: 28px;
   font-weight: 700;
 }
.inner {
   width: 1100px;
   margin: 0 auto;

}

header.php

<html>
<head>
   <?php wp_head(); ?>
</head>
   <header class="site-header">
      <?php bloginfo('title'); ?>
   </header>

footer.php

     <footer>
        <p><?php bloginfo('title');?> - &copy; <?php echo date('Y');?></p>
     </footer>
  <?php wp_footer(); ?>
  </body>
  </html>
0
Mehraj Khan 2 years 2020-10-23T10:10:39-05:00 0 Answers 9 views 0

Leave an answer

Browse
Browse