code customization of wordpress

WordPress, with a nice backend system and highly customizable frontend, can be very powerful if you know how to tweak it. This post introduces some of the important php files that you may want to look into. index.php The index.php under the theme directory (for example, ./wp-content/themes/default), is the opening gate to access a wordpress site. It calls get_header(), get_footer(), have_posts() and the_content() functions that basically produce the web page. get_header() can be found in ./wp-includes/template-function-general.php. It calls up: header.php This is a simple page where you can include the category menus, etc. With the power of CSS, the menu can be moved from left to right, or top of the page. footer.php This is where the footer and the sidebar go. Similarly, it is called by the get_footer() function in template-function-general.php. As you can see, the small files under the theme directory call the general functions defined under wp-includes. for example, wp_list_cats() is in template-function-category.php have_posts() is in functions.php the_content() is in template-functions-post.php … Now, these template*.php files are not all we want to look at. The real meat is in the classes.php file. It has all the methods to make the database call to get the categories and posts. Method like get_posts() in the classes.php will be called by the wrapper functions (have_posts() in functions.php) and retrieve all the posts under a category. As you can see once you understand the structure, you can make different type of changes to create a website that suits your need, and not just a blog. With the the back end content management system, it's a nice and powerful package.

This entry was posted in PHP development. Bookmark the permalink.