<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); $loopcounter++; ?>
// the loop stuffs
<?php if ($loopcounter <= 1) { include (TEMPLATEPATH . '/afterfirstpost.php'); } ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
Category: wordpress
<title>
<?php
if (is_home()) {
echo bloginfo('name');
} elseif (is_404()) {
echo '404 Not Found';
} elseif (is_category()) {
echo 'Category:'; wp_title('');
} elseif (is_search()) {
echo 'Search Results';
} elseif ( is_day() || is_month() || is_year() ) {
echo 'Archives:'; wp_title('');
} else {
echo wp_title('');
}
?>
</title>
Add the following line in functions.php
function custom_init_method() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js');
wp_enqueue_script( 'jquery' );
}
add_action('init', 'custom_init_method');
and add the following line on header.php before wp_head();
wp_enqueue_script('jquery');
Add the following to the functions.php
Appends .html to the URL of PAGES when using permalinks
By default, WordPress category permalinks are displayed that way:
http://www.omasters.com/blog/category/categorytitle
As you can see, the category in the url is pretty useless. Here’s how to remove it:
First backup your .htaccess file. Then, open it and append the following line:
RewriteRule ^category/(.+)$ http://www.yoursite.com/$1 [R=301,L]
Once saved, your categories pages will be displayed like this:
http://www.catswhocode.com/blog/wordpress
Better, Solution You can simply use plugin to solve the issue
The Top Level Categories plugin allows you to remove the prefix before the URL to your category page. For example, instead of http://fortes.com/category/work, I use http://fortes.com/work for the address my “work” category. WordPress doesn’t allow you to have a blank prefix for categories (they insert category/ before the name), this plugin works around that restriction.
Download Top Level Categories Plugin
More details ( More )
Template Tags/query posts
if (window.showTocToggle) { var tocShowText = “show”; var tocHideText = “hide”; showTocToggle(); }
Description
Query_posts can be used to control which posts show up in The Loop. It accepts a variety of parameters in the same format as used in your URL (e.g. p=4 to show only post of ID number 4).
Why go through all the trouble of changing the query that was meticulously created from your given URL? You can customize the presentation of your blog entries by combining it with page logic (like the Conditional Tags) — all without changing any of the URLs.
Common uses might be to:
- Display only a single post on your homepage (a single Page can be done via Settings -> Reading).
- Show all posts from a particular time period.
- Show the latest post (only) on the front page.
- Change how posts are ordered.
- Show posts from only one category.
- Exclude one or more categories.
Important note
The query_posts function is intended to be used to modify the main page Loop only. It is not intended as a means to create secondary Loops on the page. If you want to create separate Loops outside of the main one, you should create separate WP_Query objects and use those instead. Use of query_posts on Loops other than the main one can result in your main Loop becoming incorrect and possibly displaying things that you were not expecting.
The query_posts function overrides and replaces the main query for the page. To save your sanity, do not use it for any other purpose.
Usage
Place a call to query_posts() in one of your Template files before The Loop begins. The wp_query object will generate a new SQL query using your parameters. When you do this, WordPress ignores the other parameters it receives via the URL (such as page number or category). If you want to preserve that information, you can use the variable $query_string in the call to query_posts().
For example, to set the display order of the posts without affecting the rest of the query string, you could place the following before The Loop:
query_posts($query_string . "&order=ASC")
When using query_posts in this way, the quoted portion of the argument must begin with an ampersand (&).
http://blog.bluefur.com/2008/05/15/wordpress-plugin-tutorial-hello-world/
Tutorial from wordpress…
Writing a Plugin
Introduction
Prior to WordPress Version 1.2, if you wanted to modify the behavior of WordPress, you had to edit (or “hack”) the WordPress source code. However, in more current versions of WordPress, you can easily modify and add to the functionality of the core version of WordPress by using Plugins. The basic idea of the plugin architecture is to keep the core of WordPress relatively simple, but flexible enough that nearly every aspect of its input and output can be modified by plugins. Here is a definition:
View full article »
WordPress Coding Standards
Some legacy parts of the WordPress code structure for PHP markup are inconsistent in their style. WordPress is working to gradually improve this by helping users maintain a consistent style so the code can remain clean and easy to read at a glance.
View full article »


