Convert static HTML template into wordpress

 First download file from here for template -> https://github.com/LearnWebCode/university-static

And go to template index.html file and copy header section and paste after body in header.php

And go to index.html and copy footer section and paste in theme footer.php above body.

Now go to template folder and copy src build css and images folder to theme folder.

Now i have new styles in css folder i want load this so update university_files() in functions.php like->

wp_enqueue_style('university_main_styles', get_stylesheet_uri());

to 

  wp_enqueue_style('university_main_styles', get_theme_file_uri('/build/style-index.css'));
  wp_enqueue_style('university_extra_styles', get_theme_file_uri('/build/index.css'));

and save and refresh blog.

also remove body css color from style.css

And for load fontawesome copy link from index.html and add update university_files() function like below ->

function university_files() {
   wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
  wp_enqueue_style('university_main_styles', get_theme_file_uri('/build/style-index.css'));
  wp_enqueue_style('university_extra_styles', get_theme_file_uri('/build/index.css'));
}

and save it check theme footer.

and same do for google custom fonts like below ->

function university_files() {
  wp_enqueue_style('custom-google-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:100,300,400,400i,700,700i');
   wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
  wp_enqueue_style('university_main_styles', get_theme_file_uri('/build/style-index.css'));
  wp_enqueue_style('university_extra_styles', get_theme_file_uri('/build/index.css'));
}

and save


Now go to index.html and copy main content between header and footer and copy and paste in index.php by removing while loop and save.

Now display images from index.php file use function like below ->

<div class="page-banner__bg-image"
    style="background-image: url(<?php echo get_theme_file_uri('images/library-hero.jpg')  ?>)"></div>

and save check theme.


Now load scripts before body tag so update university_files() function like below -> 

function university_files() {
  wp_enqueue_script("main-university-js", get_theme_file_uri('/build/index.js'), array('jquery'), '1.0', true);
  wp_enqueue_style('custom-google-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:100,300,400,400i,700,700i');

and save and check theme.

Comments

Popular posts from this blog

Basics Of PHP

Creating App.js for Node Application

WordPress Full Guide For Developer