Wordpress Cheat Sheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

WordPress

Cheat Sheet
Basic Template files PHP Snippets for Header
style.css Style sheet file <?php bloginfo('name');?> Title of the site
index.php Home page file <?php wp_title('); ?> Title of the specific post or page
single.php Single post page file <?php bloginfo('stylesheet_url'); ?> The style.css file's location
archive.php Archive/category file <?php bloginfo('pingback_url'); ?> Pingback URL for this site
searchform.php Search form file <?php bloginfo('template_url'); ?> Location for the site's theme files
search.php Search content file <?php bloginfo('version'); ?> WordPress version for the site
404.php Error page file <?php bloginfo('atom_url'); ?> Atom URL for the site
comments.php Comments template file <?php bloginfo(rss2_url'); ?> RSS2 URL for the site
footer.php Footer content file <?php bloginfo('url'); ?> Exact URL for the site
header.php Header content file <?php bloginfo('namel'); ?> Name of the site
sidebar.php Sidebar content file <?php bloginfo('html_typel'); ?> HTML version of the site
page.php Single page file <?php bloginfo('charset'); ?> Charset paramter of this site

PHP Snippets for Templates Navigation Menu


<?php the_content(); ?> Content of the posts Category Based Navigation
<?php if(have_posts()) : ?> Check if there are posts <ul id="menu">
<?phpwhile(have_posts()) : the_post(); ?> Show posts if posts are available <li <?php if(is_home()) { ?> class="corrent-cat" < ?php } ?>>
<?php endwhile; ?> Closes the 'while' PHP function <a href="<?php bloginfo('home'); ?>">Home</a></li>
<?php endif; ?> Header.php file's content < ?php wp_list_categories('title_li=&orderby=id'); ?>
<?php get_header(); ?> Footer.php file's content </ul>
<?php get_sidebar(); ?> The date in '08-18-07' format Pages Based Navigation
<?php get_footer(); ?> Link for the comments on the post <ul id="menu">
<?php the_time('m-d-y') ?> Title of a specific post or page <li <?php if(is_home()) { ?> class="current_page_item" < ?php } ?>>
<?phpcomments_popup_link(); ?> Url of a specific post or page <a href="<?php bloginfo('home'); ?>">home</a></li>
<?php the_title(); ?> Category of a specific post or page < ?php wp_list_pages('sort_column=menu_order&depth=1&title_li=''); ?>
<?php the_permalink() ?> Author of a specific post or page </ul>
<?php the_category(', ') ?> ID of a specific post or page
<?php the_author(); ?> Link to edit a specific post or page
<?php the_ID(); ?> Links from the blogroll Extra Stuff
<?php edit_post_link(); ?> Comments.php file's content /%postname%/ Custom permalinks
<?php get_links_list(); ?> List of pages for the site <?php unclude(TEMPLATEPATH. `/x); ?> Include any file (1)
<?php comments_template(); ?> List of categories for the site <?php the_search_query(); ?> Value for search form
<?php wp_list_pages(); ?> Url to the next post <?php_e('Message'); ?> Prints out message
<?php wp_list_cats(); ?> The built-in calendar <?php wp_register(); ?> Displays the register link
<?php next_post_link(' %link '); ?> url to the next post <?php wp_loginout(); ?> Displays the login/logout link (2)
<?php previous_post_link(' %link '); ?> Url to the previous post <!--next page--> Divides the content into pages
Cuts off the content and adds a
<?php get_calendar(); ?> The built-in calendar <!--more-->
link to the rest of the content
<?php wp_get_archives(); ?> List of archives for the site <?php wp_meta(); ?> Meta for administrators
<?php posts_nav_link(); ?> Next and previous post link <?php timer_stop(1); ?> Time to load the page
<?php bloginfo('description'); ?> Site's description <?php echo get_num_queries(); ?> Queries to load the page

(1) Replace x with file name (2) Only for registered users

The Loop
<?php if (have_posts());?>
<?php while(have_posts()); the_post();?>
// Post content here (Custom HTML & PHP code)
<?php else;?> Created by StartBloggingOnline.com
<?php endif;?>

You might also like