Back End Programming

How to convert your HTML website into WordPress? – Part 1

How to convert your HTML website into WordPress? – Part 1

We all know WordPress is a well-known content management system for our website these days. Most of the designers either buying WordPress themes to design their client’s websites. But some are using HTML templates to converted into WordPress.  Today we will learn how we will go and convert our HTML template into WordPress.

Before I am starting this session you must know the basics of WordPress theming and folder structure.

wp-admin – define the WordPress admin folder.wp-content – where theme, upload, plugin folder resides.

wp-includes – WordPress core folder and file.

Rest of these files are the core files for WordPress which includes like wp-config.php, wp-setting.php etc.

Before we move I will share some basics of WordPress hooks which we will use in our theme.

1. wp_head() – we will use this hook in our header section. If you are not using this hook you will not get all your plugins CSS and other configuration JavaScript.

2. wp_footer() – we will use this hook in our footer section. Same like I mentioned above if we are omit this then we will not get our plugin javascript which normally comes in our footer.

Lets begin our session with step wise:

1. create a theme folder in your wp-content/theme/themefoldername (example my folder is wontonee)

2. Create a file name style.css. This is one of the most important files in our theme where we define the theme name and also if any stylesheet, we are having then we can link it here. In the bottom code I am defining my theme name, author name, description, version and tag.

    
     /*
Theme Name: Wontonee
Author: Saju Gopal
Description: Theme for wontonee
Version: 1.0
Tags: bootstrap
*/
    
   

3. create a filename header.php and paste this code.

    
     
 >
    
        <meta>
        <meta content="ie=edge">
        <title><?php echo get_bloginfo( 'name' ); ?>-<?php echo(the_title()); ?></title>
        <meta content="width=device-width, initial-scale=1">
        
        <meta name="yandex-verification" content="a7ebb03bf6def160">
       <!-- Style.css -->
  
  <!-- Here how we custom CSS  -->
  
        <?php wp_head();?>
    
    



    
   

4. Create a filename footer.php and paste this code.

    
     <!--this will be any custom javascript ->
<script src="<?php echo get_bloginfo( 'template_directory' );?>/js/default/active.js" defer></script> <?php wp_footer(); ?> </body> </html>  

5. Create a index.php and paste this below code. This will call our header and footer.

    
     <?php get_header(); ?>
<?php get_footer(); ?>
    
   

6. Create a page.php for pages.

    
     <?php get_header(); ?>
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();

 get_template_part( 'content', get_post_format() );

endwhile; endif;
   ?>
<?php get_footer(); ?>

    
   

7. Create a single.php for blog posts and page this code.

    
     <?php
get_header(); ?>
<div class="conatiner">
    
    <div class="row justify-content-center">
<div class="col-12 col-sm-10 col-md-8">
            <!-- Blog Details Area-->
            <div class="single-blog-details-area">

<?php if (have_posts()):
    while (have_posts()):
        the_post(); ?>
       
        <?php get_template_part("content", get_post_format());
    endwhile;
endif; ?>
</div>
           
          
          

8. Create a function.php where we will initialize our theme. I am not including TGP for default plugin initialization in this.

    
     function wontone_theme_setup(){

  add_theme_support(
    'custom-logo',
    array(
      'height'      =&gt; 240,
      'width'       =&gt; 240,
      'flex-height' =&gt; true,
    )
  );

  register_nav_menus(
    array(
      'header-menu' =&gt; __( 'Header Menu' ),
      'footer-menu' =&gt; __( 'Footer Menu' )
     )
   );

}

 add_action( 'init', 'wontone_theme_setup' );

    
   

8. Create a screenshot.png which will create a thumbnail of our theme.

Now zip your folder wontonee and upload through WordPress appearance > theme >upload.  This is how my structure look like.
teamwontonee

Recent Posts

Laravel And Vue Contact Form

In this tutorial we will learn about how to create a contact form in vue…

3 years ago

Basics Of Laravel And VUE JS

Laravel is a popular open-source framework developed by Taylor otwell for PHP. Laravel comes with…

3 years ago

Google Verified SMS

SMS play a vital role in our day-to-day life. For instance, if we want to…

3 years ago

Bagisto Laravel Razorpay Extension

Bagisto is an open-source Laravel eCommerce application. Bagisto is one of the popular eCommerce applications…

3 years ago

Bagisto Laravel Paytm Extension

Bagisto is an open-source Laravel eCommerce application. Bagisto is one of the popular eCommerce applications…

3 years ago

Tweaks And Tips to secure your wordpress website?

From the last few years website design is quite easy and convenient with various content…

3 years ago

This website uses cookies.