Here is a
list of WordPress Code Snippets that can be used in your every day
coding phase. If you take a print out of it then it will be the best so
that you can keep it your self and distribute among others.
PHP Snippets for Header
Title of the site < ?php bloginfo(’name’); ? >
Title of specific post or page < ?php wp_title(); ? >
The style.cssfile's theme location < ? php
bloginfo(’stylesheet__url’); ? >
Pingback URL for the site < ?php
bloginfo('pingback_url');? >
Location for the site's theme file < ?php bloginfo(’template_url');?
>
Wordpress version for the site < ?php
bloginfo('version');? >
Atom URL for the site < ?php bloiginfo('atom_url');'?
>
Exact URL for the site < ?php bloginfo('rss2_url');? >
Name of the site < ?php bloginfo('name');? >
Html version of the site < ?php bloginfo('htm1_type');?
>
Charset parameter of the site < ?php bloginfo('charset');?
>
Style sheet file style.css
Homepage file index.php
Single post page file single.php
Archive/category file a1-chive.php
Search form file searchform.php
Search content file search.php
Error page file 404.php
Footer content file footer.php
Comments template file comments.php
Header content file header-.php
Sidebar content file sideba:-.php
Single page file page.php
Custom permalinks /%postname%/
Include any file < ?php include(TEMPLATEPATH .‘/x’); ?
>
Value for search form < ?php the_search_query(); ? >
Prints out message < ?php _e(’Message’); ? >
Displays the register link < ?php wp_register(); ? >
Displays the login/logout link < ?php wp_loginout(); ?
>
Divides the content into pages
Cuts of" the content <1--more-->
Meta for administrators < ?php wp_meta(); ? >
Time to load the page < ?php timer_stop(1); ? >
Queries to load the page < ?php echo get_num_queries(); ?
>
PHP Snippets for Templates
Author of a specific post or page < ?php the_author(); ?
>
Content of the posts < ?php the_content(); ? > ‘
ID of a specific post or page < ?php the_ID(); ? >
Checks if there are posts < ?php if(have_posts()) : ?
>
Link to edit a specific post or page < ?php edit
_post_link(); ? >
Shows posts if posts are available < ?php
while(have__posts()) : the _post(); ? >
Links from the blogroll < ?php get_links_list(); ? >
Closes the 'while' PHP function < ?php endwhile; ? >
Comment.php files content < ?php comments_template(); ?
>
Closes the 'if PHP function < ?php endif; ? >
List of pages of the site < ?php wp_list_pages(); ? >
Header.php file's content < ?php get_header(); ? >
List of categories for the site < ?php wp_list_cats(); ?
>
Sidebar.php files content < ?php get_sidebar(); ? >
Url to the next post < ?php next _post_link(' %link ') ?
>
Footer.php file's content < ?php get_footer(); ? >
Url to the previous post < ?php previous _post_link('%link')
? >
The date in '08-18-07' format < ?php the_time('m-d-y') ?
>
The built-in calendar < ?php get_calendar(); ? >
Link for the comments on the post < ?php
comments_popup_link(); ? >
List of archives for the site < ?php wp_get_archives() ?
>
Title of a specific post or page < ?php the_title(); ?
>
Next and previous post link < ?php posts_nav_link(); ?
>
Url of a specific post or page < ?php the _permalink() ?
> ‘
Site’s description < ?php bloginfo(’description’); ? >
Category of a specific post or page < ?php
the_category(', ') ? > ‘