Posts by :
- the use of $post_counter to create the divs for each row
- the creation of a div with class=”post_class” to contain each post
- the use of CSS to set the width of post_row and post_class
A number of requests have been posted for a way to use sticky posts when displaying a category. The code below can be used to modify your category.php to use for all categories, or as category-id#.php to use for a given category id.
The code is an example only. It must be used to modify your code to fit your theme.
Several persons have asked for a template to list posts or pages by the first letter of the title. The code below is set for posts, but is easily modified for pages or custom posts. The CSS will need to be modified to fit your own theme.
This template lists a set number of post titles per page. See this Tip for a template that lists one letter per page.
Here is a screenshot of the first page:
Here is a handy post by Doug Dalton with a shortcode to include a file in a post or page.
If you want to have several posts in a row across the page, you can use code similar to this. This code is an example. You will need to customize it to your theme.
The important things to note are:
You will need to add the CSS to float the posts left, set the width, and probably set some margins. There is some sample CSS following the code. Read the rest of this entry “
How do I show a Category on a Page? Or, for that matter, how do I link to anything I want? This question comes up regularly on the Support forums.
The question really breaks down into two parts:
- How do I show categories on a page?
- How do I keep from duplicating the posts on the Home/Blog page?
There are several ways to do this, depending on your theme and the version of WordPress you are using. Read the rest of this entry “
There are often posts on the WP Support forum asking how to paginate a custom query or an array. Here is a link to an article with one solution: Pagination Without Using A Plugin
A WP user had a large number of posts in a certain category. They wanted to add a tag to each post in that category. Here is the procedure to do that with SQL commands. Read the rest of this entry “
Here is sample code to list posts alphabetically under the first letter of the title.
For a complete template, see this post.
Use template parts in WP 3.0 for repeated blocks of code. In the example below, you would create a file called loop-custom.php which would be called from each section. Read the rest of this entry “
If you want to override the original arguments, you must merge your argument array last (reverse of what is shown in Codex):
global $wp_query; query_posts( array_merge( $wp_query->query, array('cat' => 1) ) );