WP php tweaks

WP php tweaks

Useful PHP Code for Header

<?php bloginfo(‘name’); ?> Title of the site
<?php wp_title(); ?> Title of the post or page
<?php bloginfo(‘stylesheet_url’); ?> The style.css file’s location
<?php bloginfo(‘pingback_url’); ?> Pingback URL for the site
<?php bloginfo(‘template_url’); ?> Location for the site’s theme files
<?php bloginfo(‘version’); ?> WordPress version for the site
<?php bloginfo(‘atom_url’); ?> Atom URL for the site
<?php bloginfo(‘rss2_url’); ?> RSS2 URL for the site
<?php bloginfo(‘url’); ?> Exact URL for the site
<?php bloginfo(‘name’); ?> Name of the site
<?php bloginfo(‘html_type’); ?> HTML version of the site
<?php bloginfo(‘charset’); ?> Charset parameter of the site
<?php bloginfo(‘description’); ?> Site’s description

Useful PHP Code for the Body

<?php the_content(); ?> Content of the posts or page
<?php if(have_posts()) : ?> Checks if there are posts
<?php while(have_posts()) : the_post(); ?> Shows posts if posts are available
<?php endwhile; ?> Closes the ‘while’ PHP function
<?php endif; ?> Closes the ‘if’ PHP function
<?php get_header(); ?> Header.php file’s content
<?php get_sidebar(); ?> Sidebar.php file’s content
<?php get_footer(); ?> Footer.php file’s content
<?php the_time(‘m-d-y’) ?> The date in ’08-18-10′ format
<?php comments_popup_link(); ?> Link for the comments on the post
<?php the_title(); ?> Title of a specic post or page
<?php the_permalink() ?> Url of a specic post or page
<?php the_category(‘, ‘) ?> Category of a specic post or page
<?php the_author(); ?> Author of a specic post or page
<?php the_ID(); ?> ID of a specic post or page
<?php edit_post_link(); ?> Link to edit a specic post or page
<?php get_links_list(); ?> Links from the blogroll
<?php comments_template(); ?> Comment.php file’s content
<?php wp_list_pages(); ?> List of pages of the
<?php wp_list_cats(); ?> List of categories for the site
<?php next_post_link(‘ %link ‘) ?> Url to the next post
<?php previous_post_link(‘%link’) ?> Url to the previous post
<?php get_calendar(); ?> The built-in calendar
<?php wp_get_archives() ?> List of archives for the site
<?php posts_nav_link(); ?> Next and previous post link
<?php wp_loginout(); ?> Displays the login/logout link
<!–more–> Cuts off the content and adds a link to the rest of the content
<?php wp_meta(); ?> Meta for administrators

Other Useful PHP Functions

<?php timer_stop(1); ?> Time to load the page
<?php echo get_num_queries(); ?> Queries to load the page