Wednesday, 24 December 2014

How to convert html website to wordpress theme?

(1)create folder name as mytheme in wp_content
(2)copy index.html file to mytheme & rename it as index.php
(3)copy the content of header from index.php and save it is as header.php
(4)in header.php  link of href for stylesheet url code is  <?php bloginfo('stylesheet_url')?>
(5)then type <?php get_header(); ?>
(6)copy the code of index.php and paste into footer.php
(7)then open index.php and type  <?php get_footer(); ?>
(8)then type  <?php wp_footer();?> in end of footer.php file.
(9)then copy sidebar html code form index.php to sidebar.php file.
(10)and then type  <?php get_sidebar(); ?> into the index.php file.
(11)create single .php form index.php code.
(12)copy  loop code
to index.php

<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
  <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="post-header">
        <div class="date"><?php the_time( 'M j y' ); ?></div>
        <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
        <div class="author"><?php the_author(); ?></div>
    </div><!--end post header-->
    <div class="entry clear">
        <?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail(); ?>
        <?php the_content(); ?>
        <?php edit_post_link(); ?>
        <?php wp_link_pages(); ?>
    </div><!--end entry-->
    <div class="post-footer">
        <div class="comments"><?php comments_popup_link( 'Leave a Comment', '1 Comment', '% Comments' ); ?></div>
    </div><!--end post footer-->
  </div><!--end post-->
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
  <div class="navigation index">
    <div class="alignleft"><?php next_posts_link( 'Older Entries' ); ?></div>
    <div class="alignright"><?php previous_posts_link( 'Newer Entries' ); ?></div>
  </div><!--end navigation-->
<?php else : ?>
<?php endif; ?>

Read the code for  wordpress file... website links..

to image link:

<img alt="" src="<?php bloginfo( 'stylesheet_url' ); ?>/images/logo.jpg" />

(13)to create new page for use template file page.php
following is the code for that

<?php get_header(); ?>

 <div id="content">
<?php if(have_posts()): ?>
<?php while(have_posts()):the_post()?>
<?php the_content(''); ?>
<?php endwhile; ?>
<?php endif; ?>

<?php get_footer(); ?>