Full Cheat Sheet for Wordpress

Sometime we search in google for wordpress function. I am trying to collect all the basic function’s list here which is need for wordpress theme development. This list will be very helpful if practice it regularly.

 

Theme Structure

header.php …………………….Header

Sectionindex.php …………………….Main

Sectionsidebar.php ………………..Sidebar

Sectionsingle.php …………………..Post

Templatepage.php …………………….Page

Templatecomments.php ………………Comment

Templatesearch.php ………………….Search

Contentsearchform.php …………Search Form

Templatearchive.php ……………….Archive

Templatefunctions.php …………….Special

Functions404.php ………………..Error Page

templatestyle.css ……………………..Style Sheet

 

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

The Loop

 

<?php if(have_posts());?>

 

<?php while(have_posts()); the_post();?>

 

// The Stuff… Custom HTML & PHP Code

 

<?php else;?>

 

<?php endif;?>

 

 

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

 

The Category Based Loop

 

 

 

 

Category&showposts=10′); ?>

 

<?php while (have_posts()) : the_post(); ?>

 

// The Stuff… Custom HTML & PHP Code

 

<?php endwhile;?>

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

 

Theme Definition

 

/* Theme Name: WordPressTheme URI: http://wordpress.org/

 

Description: Test BlogVersion: 1.6

Author: Ekin ErtaçAuthor

URI: http://ekinertac.com

Tags: powerful, cheat, sheet */

 

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

Template Include Tags: 

 

< ?php get_header(); ?>

 

< ?php get_sidebar(); ?>

 

< ?php get_footer(); ?>

 

< ?php comments_template(); ?>

 

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

WordPress Template Tags

 

<?php the_title() ?> …………………Displays the posts/pages title

 

<?php the_content() ?> …………Displays the content of the post/page

 

<?php the_excerpt() ?> ….Displays the excerpt of the current post/page

 

<?php the_time() ?> ……….Displays the time of the current post/page

 

<?php the_date() ?> …..Displays the date of a post or set of post/page

 

<?php the_permalink() ?> ………….Displays the URL for the permalink

 

<?php the_category() ?> ……………..Displays the category of a post

 

<?php the_author(); ?> ………………Displays the author of the post

 

<?php the_ID(); ?> ……….Displays the numeric ID of the current post

 

<?php wp_list_pages(); ?> ……………………Displays all the pages

 

<?php wp_tag_cloud(); ?> ………………………Displays a tag cloud

 

<?php wp_list_cats(); ?> ……………………Displays the categories

 

<?php get_calendar(); ?> ……………………..Displays the calendar

 

<?php wp_get_archives() ?> ……….Displays a date-based archives list

 

<?php posts_nav_link(); ?> …Displays Previous page and Next Page links

 

<?php next_post_link() ?> …………………Displays Newer Posts link

 

<?php previous_post_link() ?> ………………..Displays previous link

 

<?php edit_post_link(__(‘Edit Post’)); ?> ……..Displays the edit link

 

<?php the_search_query();?> …………….Value for search form

 

<?php wp_register();?> …………….Displays the register link

 

<?php wp_loginout();?> …………..Displays the log in/out link

 

<?php wp_meta();?> …………………..Meta for administrators

 

<?php timer_stop(1);?> …………………Time to load the page

 

<?php echo c2c_custom(‘test’);?> ……Displays the custom field1

 

<?php get_links_list(); ?> ………..Display links from Blogroll

 

<?php get_calendar(); ?> ……….Displays the built-in calendar

 

<?php comments_popup_link(); ?> …….Link of the posts comments

 

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

BlogInfo Tags

 

 

<?php bloginfo(‘name’); ?> ………………………Title of the blog

 

<?php bloginfo(‘charset’); ?> ……………………The character set

 

<?php bloginfo(‘description’); ?> ……….The description of the blog

 

<?php bloginfo(‘url’); ?> ………………….The address of the blog

 

<?php bloginfo(‘rss2_url’); ?> ………………………..The RSS URL

 

<?php bloginfo(‘template_url’); ?> ………….The URL of the template

 

<?php bloginfo(‘pingback_url’); ?> ………………..The pingback URL

 

<?php bloginfo(‘stylesheet_url’); ?> The URL for the template’s CSS file

 

<?php bloginfo(‘wpurl’); ?> ………….URL for WordPress installation

 

<?php bloginfo(‘version’); ?> ….Version of the WordPress installation

 

<?php bloginfo(‘html_type’); ?> ……………HTML version of the site

 

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

BlogInfo Tags

 

is_home() …………………..When the user is on the blog home page

 

is_front_page() ………………….When the user is on the home page

 

is_single() …………………………When the single post displayed

 

is_sticky() …………………………….Check if a post is sticky

 

is_page() ……………………………….When a page is displayed

 

is_category() …………………………When a category is displayed

 

 

 

 

 

-_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_–_-

 

 

 

Navigation Menu

 

 

 

Category Based Navigation

 

 

    • >Home

 

< ?php wp_list_categories(‘title_li=&orderby=id’); ?>

 

Pages based Navigation

 

 

    • >home

 

< ?php wp_list_pages(‘sort_column=menu_order&depth=1&title_li=’); ?>

 

is_home()

 

 

 

 

…………………..When the user is on the blog home page

is_front_page() ………………….When the user is on the home pageis_single() …………………………When the single post displayedis_sticky() …………………………….Check if a post is stickyis_page() ……………………………….When a page is displayedis_category() …………………………When a category is displayed

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s