Wordpress Customizing

Wordpress is a really good blogging tool, its the best. I know how hard it is to understand including it in your layout if you have just installed it. I had b2 before wordpress and I thought wordpress was very similar to b2 but still it took me ages to understand how to include it in my layout the way I want. This tutorial explains it.
Note: This tutorial was written for wordpress 1.2. I know that was old version but thats the one that I still use.

Tutorial

» Make (code) a layout, the way you like it, like you always make cool layouts for your sites.
» Open the layout code in notepad or anything you like to use for code editting.
» Now you need to insert the codes into your layout as shown below, these are wordpress tags.

NOTE-This tutorial assumes that you have installed wordpress in a folder called "Wordpress" in your root directory.
» If your comments show up in pop up and you dont want them to, go to wordpress options > General and make your settings as shown in this picture. Change site url to your own...this is only if you have installed the wordpress in a folder called wordpress in your root directory.


REQUIRED ENTITIES

Blog Header
On the very top of page, above everything (EVERYTHING), add the following code,

<?php require("/home/USER/public_html/Wordpress/wp-blog-header.php"); ?>


Here USER is your username that you use to login to your cpanel (if you are hosted, ask your host the exact php path).

Wordpress Begining
This code should be added to the place where you want your blog to show up in your layout.

<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>


The Entries
Add this code where you want your blog entries to show up below the above code.

<?php the_content(); ?>


This code can not be skipped, it shows your blog entries!


OPTIONAL ENTITIES

The Title
This code will show your blog entry's title. Put it anywhere you like.

<?php the_title(); ?>


Time
The code below shows the date and time of your blog and a permanent link to the particular post. You can skip it if you want.

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"<>?php the_date('d-m-y','','',true); ?></a>


You can further change the way these permalinks and dates show up, I have put the code that I use here.

Categories
The code below will show the category to which the post belongs. Put i anywhere you want the categories to show up.

<?php the_category(','); ?>


Category
The place where you want to show the entry category, put the code below,

<?php the_category() ?>


Comments
This is the comments link, put it anywhere you want.

<?php comments_popup_link(__('0 Comments'), __('1 Comment'), __('% Comments')); ?>


You can change the word 'comment' with anything else you want.


REQUIRED ENTITIES

End Entry
Put this code anywhere below all the "optional tags"

<?php include(ABSPATH . 'wp-comments.php'); ?>


End Wordpress Loop
Put this code in the end, after all the above mentioned codes. This is required and you can not skip it.

<?php endforeach; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?> </p> <?php endif; ?>


The content will be shown in the same way as you arranged the above shown tags. Dont play with the required entities though. After adding all these tags, save your page as .php upload it to see how your template looks like, play around the optional tags until it looks exactly the way you want it to, good luck!


An example of how all these codes together look in the most common wordpress templates, they go with almost all kind of layouts is shown below. If you are having trouble understanding all the tags and all, just copy the first required tag on top of you page and copy the code below and paste it where you want your blog to show up. ( dont forget change the USER to your username in the first tag). The class 'header' used below can be taken off or you can make a class called header in your css file and customize it the way you want to.

<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
<div class="header"><?php the_title(); ?> @ <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"<<?php the_date('d-m-y','','',true); ?></a></div>
<?php the_content(); ?>
<?php wp_link_pages(); ?>
<div align="right"> <br>
<?php the_category(','); ?> - <?php comments_popup_link(__('0 Comments'), __('1 Comment'), __('% Comments')); ?>
</p>
</div>

<?php include(ABSPATH . 'wp-comments.php'); ?>
<?php endforeach; else: ?>
<p^gt;<?php _e('Sorry, no posts matched your criteria.'); ?>
</p>
<?php endif; ?>
</p>

The code above will generate entries like this in your layout,

Title of blog entry here @ 21-03-2005

The entry content will be shown here...... The entry content will be shown here...... The entry content will be shown here...... The entry content will be shown here......

Category - 0 Comments



Note: Any questions regarding this tutorial should be asked here.


« Back