Create a WordPress Theme from HTML5

Create a WordPress Theme from HTML5
December 20, 2013

WordPress has become one of the most widely used blogging platform in the world. It is being used in lots of websites online today. The look and presentation of all these sites depends on WordPress Themes.

A WordPress Theme is a collection of files that provides design and functionality to the wordpress site. If you are an absolute beginner, this article will help you to get started in developing a worpress theme.

 

Assumption:

We assume that anyone who wants to create wordpress theme already cover given three points:

  • Basic understanding of HTML5 and CSS.
  • HTML theme in HTML5 and CSS.
  • WordPress already installed.

 

WordPress Functionality

WordPress relies on PHP to call to any part of the content in the site. The data is called from the database and PHP is used to display it in the HTML. This is how the wordpress works.

 

Creating The WordPress Theme

Step1:

To start with it, firstly create a sub-folder into wp-content/themes directory in your wordpress folder and name it whatever you want it to be called. Now create these two files:

  • Style.css
  • Index.php

These are the required files for WordPress Theme Development.

 

Step2:

Now add an appropriate heading to style.css like this:

Wordpress blog1

With the help of these comments WordPress identifies the theme. Now, copy the original CSS file which is placed in HTML5 site and paste it into the style.css file you just created.

Now, theme’s style.css is ready.

 

Step3:

Since in wordpress, files are called with the help of PHP function calls. So index.html file needs to be split into four different files and they are:

  • Header.php
  • Index.php
  • Sidebar.php
  • Footer.php

These 4 separate files belong to the 4 different sections of the layout.

Wordpress blog2

 

Step4:

Now adding the code into these files:

 

1) Header.php

As the name suggest, this file represents the header part of your layout. In this file we can specify all the meta tags such as title of the website and meta descriptions. After this, add this line to load the style.css.

<link rel=”stylesheet” href=”/<?php bloginfo(‘stylesheet_url’); ?>”>

This line will handle the styling of your wordpress site.

Note: If there are more than one stylesheets files, include them in header file with the normal<style> tag.

<link rel=”stylesheet” type=”text/css” href=”/<?php echo get_template_directory_uri(); ?>/css/default.css” />

get_template_directory_uri() enques the script from the correct path. So, if we need to add any script into our file, which must be done with the help of this function.

 

2) Index.php

This file begins with the code <?php get_header();?> which includes the header.php file.After that,Main Content area gets started which includes the PHP code to check whether there are any posts and displays them.

To include the search form, use <?php get_search_form(); ?>

After that it include code for sidebar

<?php get_sidebar();?>

This line include sidebar.php template file from your current theme’s directory. If a name ($name) is specified then a specialized sidebar sidebar-{name}.php will be included.

<?php get_sidebar(‘left’); ?> this will look for  sidebar-left.php template file from your current theme’s directory.

and At the end  the code <?php get_footer(); ?> which includes  the footer.php file.

 

3) Sidebar.php

To include the search form in sidebar, use <?php get_search_form(); ?>

To include widgets use <?php dynamic_sidebar(); ?>

This function calls each of the active widget callbacks in order, which prints the markup for the sidebar. If you have more than one sidebar, you should give this function the name or number of the sidebar you want to print. This function returns true on success and false on failure.

E.g.

<?php dynamic_sidebar( ‘Right Sidebar’ ); ?> will include the widget having name ‘Right Sidebar’ .

After this the code <?php wp_loginout(); ?> can be used to displays a login link, or if a user is logged in, displays a logout link.

To include archives, use <?php wp_get_archives( ‘type=monthly’ ); ?>

To creates the wp_meta action hook,which allows functions to insert content to the sidebar,use <?php wp_meta(); ?>

 

4) Footer.php

As the name suggest, this file represents the footer part of your layout.

It contains all the footer Content that you want to display in footer area.

If you want to display widgets in footer section you can use <?php get_sidebar(‘footer’); ?> which will include widget named footer.

This file generally ends with <?php wp_footer(); ?> which fire the ‘wp_footer’ action. Put this template tag immediately before </body> tag in a theme template (ex. footer.php, index.php).

Please follow and like us:

79 comments

  1. Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. Seo Plugin

  2. Bongs are specially popular in areas of Europe and in the Mideast, but their reputation has exploded in the U.S.A.
    and Canada, mostly in The United States.

  3. You actually make it appear so easy along with your presentation however I in finding this topic to be actually something which I believe I would
    never understand. It sort of feels too complicated and extremely vast for me.
    I’m having a look forward for your subsequent publish,
    I will try to get the grasp of it!

  4. Hmm it seems like your site ate my first comment (it was super long) so I guess
    I’ll just sum it up what I submitted and say, I’m thoroughly enjoying
    your blog. I as well am an aspiring blog writer but I’m still new to everything.
    Do you have any tips and hints for inexperienced
    blog writers? I’d certainly appreciate it.

  5. Magnificent website. Plenty of helpful info here.
    I am sending it to some friends ans additionally sharing in delicious.
    And obviously, thanks in your sweat!

  6. I seriously love your website.. Very nice colors & theme.
    Did you make this website yourself? Please reply back as I’m
    planning to create my own personal site and would love
    to know where you got this from or what the theme is called.
    Kudos!

  7. Great post. I was checking continuously this weblog
    and I am impressed! Very useful information specifically the last part :
    ) I handle such information a lot. I used to be seeking this
    certain info for a very lengthy time. Thank you and good luck.

  8. Its such as you read my thoughts! You seem to know a lot
    about this, like you wrote the book in it or something.

    I believe that you just could do with some p.c. to pressure the message home a little bit, however instead of that, this
    is excellent blog. An excellent read. I will definitely be back.

  9. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You obviously know what youre talking about, why waste your intelligence
    on just posting videos to your site when you could be giving us something informative to read?

  10. I’m pretty pleased to uncover this site. I wanted to thank
    you for ones time for this fantastic read!! I definitely appreciated
    every part of it and i also have you book-marked to check out new things on your web site.

  11. I am now not positive the place you are getting your info, however great topic.
    I must spend some time learning more or working out more.
    Thanks for great info I used to be in search of this info for my mission.

  12. Thanks for every other informative blog. The place else could I am getting that
    type of info written in such an ideal means? I’ve a mission that I am just
    now operating on, and I have been at the glance out for such information.

  13. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is valuable and everything. However imagine if you added
    some great images or videos to give your posts more, “pop”!
    Your content is excellent but with pics and video clips, this
    site could undeniably be one of the best in its field.
    Good blog!

  14. Usually I don’t read article on blogs, but I would like to say that this write-up very forced
    me to try and do so! Your writing style has been surprised me.
    Thanks, very nice article.

  15. Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to more added agreeable from you! By the way, how
    could we communicate?

  16. Hi there, just became alert to your blog through Google, and found that it is
    truly informative. I’m going to watch out for brussels.
    I will be grateful if you continue this in future. Numerous people will be benefited
    from your writing. Cheers!

  17. Excellent post. Keep posting such kind of information on your blog.
    Im really impressed by it.
    Hi there, You’ve performed an incredible job. I will certainly digg it and in my opinion recommend to my friends.
    I am confident they’ll be benefited from this web
    site.

  18. Very good blog! Do you have any helpful hints for aspiring writers?
    I’m planning to start my own website soon but I’m a little lost
    on everything. Would you propose starting with a free platform like
    Wordpress or go for a paid option? There are so many options out
    there that I’m completely overwhelmed .. Any ideas?
    Bless you!

  19. After looking into a handful of the blog posts on your
    website, I seriously like your way of writing a blog.
    I added it to my bookmark webpage list and will
    be checking back soon. Please check out my website as well and let me know how you feel.

  20. Magnificent beat ! I would like to apprentice whilst you amend your web site, how could i subscribe for a blog site?
    The account helped me a applicable deal. I were tiny bit familiar of this your broadcast provided bright transparent concept

  21. I am really loving the theme/design of your website. Do you ever run into
    any internet browser compatibility problems? A few of my blog visitors have complained about my site not working correctly
    in Explorer but looks great in Firefox. Do you have any suggestions to
    help fix this issue?

  22. Today, I went to the beach with my kids. I found a
    sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is totally off topic but I had to tell someone!

  23. You are so awesome! I don’t think I’ve read a single thing like this before.
    So wonderful to find another person with some unique thoughts
    on this issue. Seriously.. thank you for starting this up.

    This web site is something that is required on the
    web, someone with a little originality!

  24. After checking out a number of the blog posts on your site, I
    seriously like your technique of writing a blog.
    I saved as a favorite it to my bookmark website list and
    will be checking back soon. Please visit my website as well and let me know what you think.

  25. Do you have a spam problem on this site; I also am a blogger, and I was wondering your situation;
    many of us have developed some nice methods and we are looking to trade strategies with other folks, be sure to shoot me an e-mail if interested.

  26. May I simply say what a comfort to find an individual who actually understands what
    they are discussing on the internet. You actually know
    how to bring an issue to light and make it important.
    A lot more people have to look at this and understand this side of
    your story. I can’t believe you are not more popular because
    you surely possess the gift.

  27. Howdy! This post couldn’t be written any better! Reading this post reminds me of my good old room mate!
    He always kept chatting about this. I will forward this article to him.
    Fairly certain he will have a good read. Many thanks for sharing!

  28. I do believe all the ideas you’ve presented in your post.

    They are really convincing and will definitely work.
    Still, the posts are too quick for starters. Could you
    please extend them a little from subsequent time?
    Thank you for the post.

  29. Thanks a bunch for sharing this with all of us you actually recognize what
    you’re speaking about! Bookmarked. Please also discuss with my
    site =). We will have a link exchange arrangement between us

  30. I’m really impressed with your writing skills as well as with the layout on your weblog.

    Is this a paid theme or did you modify it yourself?
    Anyway keep up the nice quality writing, it’s rare to see a nice blog like this one these days.

  31. Hmm is anyone else encountering problems with
    the images on this blog loading? I’m trying to find
    out if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.

  32. Hey there! I know this is somewhat off-topic
    however I needed to ask. Does running a well-established website such as yours take a massive amount work?
    I am completely new to blogging however I do write in my diary every day.
    I’d like to start a blog so I can easily share
    my experience and feelings online. Please let me know if you have any kind
    of recommendations or tips for brand new aspiring bloggers.
    Thankyou!

  33. I loved as much as you’ll receive carried out
    right here. The sketch is tasteful, your authored subject matter stylish.

    nonetheless, you command get bought an edginess over that
    you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same
    nearly a lot often inside case you shield this hike.

Leave a comment

Your email address will not be published. Required fields are marked *