How to copy a Wordpress Theme - Part 2:
Let’s start copy the well-formed tag elements
Before you start this lesson, you must have the knowledge about html and wordpress coding. The idea is that we first copy the parent tag elements and then we copy it’s child elements. We repeat the process till all of the tags are copied.
Expand each tags and try to understand the functions used in the theme
It is important to know the wordpress functions used in the theme which you’re going to copy. First expand the tags and look up and determine what functions are used inside the tags.
An example for code shown in above,
Wordpress has bloginfo function that can generate the basic information of your wordpress I already mentioned. Right now, I’m going to change with the wordpress coding. The following codes will generate the result shown in above.
<h1><a href=”<?php bloginfo(’url’);?>“><?php bloginfo(’title’);?></a></h1>
<div class=”description”><?php bloginfo(’description’);?></div>
Many of wordpress theme creators used default posts query in the theme except custom one. Some used query_posts to make custom query for some purposed. It doesn’t matter. All are in the loop.
Understand the basic structure of Post looping
The Loop is used by WordPress to display each of your posts. Using The Loop, WordPress processes each of the posts to be displayed on the current page and formats them according to how they match specified criteria within The Loop tags. This is the basic structure of the_loop. Inside this we normally put the_title(), the_permalink(), the_content(), etc.
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php endwhile; else: ?>
<?php _e(’Sorry, no posts matched your criteria.’); ?>
<?php endif; ?>
If you’re doing programming, you can easily know that the following codes are generated from Loop.
The following codes will output shown above
<div id=”post-<?php the_ID(); ?>” class=”post”>
</div>
Expand that div you’ll see the following sub elements
Expand h2 tag element.
the_title and the_permalink
the_title returns the post title and the_permalink returns the permalink of your post. So rewrite with the
php code
<h2>
<a title=”Permanet Link to <?php the_title();?>” rel=”bookmark” href=”<?php the_permalink();?>”>
<?php the_title();?></a>
</h2>
the_time or the_date
the_time returns the all the date of your post. and the_date only returns the date of first post which is published in same day. I prefer you to use the_time
<small><?php the_time(’F d, Y’);?></small>
Check date time format from PHP.net
the_content
the_content returns the content of post. Optional parameter is used for showing read more link if the post used <!–more–>
<div class=”entry”>
the_content (’Read the rest of this entry’);
</div>
the_tags
the_tags function return the tags link of the post. It was implemented in wordpress 2.3. the_tags(’start’, ’seperate’,’end’);
<p class=”postmetadata”>
the_tags (”Tags:”, “, “, “<br />”);
</p>
Wordpress uses header.php, index.php, single.php, page.php, category.php, search.php, comments.php, functions.php and footer.php for theme. Oh! you can use only index.php for your theme. But need to write more complicated codes when you’re using different style for different page. Let’s say, if you want main , single post and page different. You have to choose either conditional_tags or the page.
For example, the following code will show excerpt post while browsing the category, search, tags and main page. It shows full content when browsing … ? ha ha single post
<?php if (is_category() || is_search() || is_tags() || is_main()) {
the_excerpt();
}else {
the_content();
}
?>
I have tried it and it works
Last Minute
(1.)
You can initially rip the entire site with a freeware tool called httrack easily found via google. And then use the method described by the OP.
2.
Depending on if the site has offsite linked images and scripts you may need to change the default settings a bit to allow it to go offsite and obtain those files as well. Also if the site you are ripping has a robots.txt file you may need to change the options to completely ignore the robots.txt file so it can do it's job properly by default it is turned on to obey them.
After that you should have a nearly exact copy on your harddrive. Now fire up dreamweaver or your favorite html editor, and open up the index.html file from the ripped website now you can edit it at will. To make the php coding you add to work properly you will need to save-as index.php (for example) Then simply upload your files to your server and your on your way.