Tuesday, 8 January 2008

Wordpress Includes

The following text is simply notes taken while I study the structure of a Wordpress template. This information may not be useful to general visitors.

The blog
<?php bloginfo('url'); ?> - Blog's URL.
<?php bloginfo('name'); ?> - Blog's title.
<?php bloginfo('description'); ?> - Blog's description.
<?php posts_nav_link('<<','-','>>'); ?> - Post navigation. Optional arguments are: text between, text before all, text after all.

The post
<?php the_title(); ?> - Blog post title.
<?php the_permalink(); ?> - The permanent link to a blog post.
<?php the_content(); ?> - Blog post content.
<?php the_ID(); ?> - A unique ID for the post, can be used as a div id.

Post metadata
<?php the_category(', ') ?> - The post category listing with , as a separator.
<?php the_author(); ?> - The post author (uses display name).
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> - Comments popup link - Arguments are: No comments, 1 comment, multiple comments.
<?php edit_post_link('Edit', ' | ', '?'); ?> - Display post edit link for website authors (when logged in). Arguments are: link text, text before link, text after link.

Sidebar/Navigation
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?> - Display category list encapsulated in <li> tags. Arguments are sortcolumn by name, display the number of posts, don't nest lists for sub categories.
<?php wp_list_pages(); ?> - Displays the list of static pages. Automatically creates li and sub li tags as necessary. Extra options are: title_li - change the name of the title, depth - depth to nest sub pages. Remember to separate arguments with a &.
<?php wp_get_archives('type=monthly'); ?> - Display the blog archives. type=monthly specifies how to group archived content.
<?php get_links_list(); ?> - Display the list of links that your blog links too. This is also known as the blogroll.
<?php get_calendar(); ?> - Display the calendar.

No comments:

Post a Comment