Showing posts with label wordpress function cheat sheet. Show all posts
Showing posts with label wordpress function cheat sheet. Show all posts

Tuesday 2 June 2015

wordpress function cheat sheet



1.Theme Structure

header.php ...................... Header Section
index.php ......................... Main Section
sidebar.php .................... Sidebar Section
single.php ....................... Post Template
page.php ......................... Page Template
comments.php .................. Comment Template
search.php ...................... Search Content
searchform.php ............ Search Form Template
archive.php ................... Archive Template
functions.php ................ Special Functions
404.php .................... Error Page template
style.css .......................... Style Sheet

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

2.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


3.Theme Definition

/*
Theme Name: Wordpress Theme
Theme URI: http://wordpress.org/
Description: Test Blog
Version: 1.6
Author: Ekin ErtaƧ
Author URI: http://themesmart.org
Tags: powerful, cheat, sheet
*/

4.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

5.The Loop

<?php if(have_posts());?>
<?php while(have_posts()); the_post();?>
// The Stuff... Custom HTML & PHP Code
<?php else;?>
<?php endif;?>

6.The Category Based Loop

<?php query_posts('category_name=
Category&showposts=10'); ?>
<?php while (have_posts()) : the_post(); ?>
// The Stuff... Custom HTML & PHP Code
<?php endwhile;?>

7.Template Include Tags

< ?php get_header(); ?>
< ?php get_sidebar(); ?>
< ?php get_footer(); ?>
< ?php comments_template(); ?>

8.Navigation Menu

Category Based Navigation
<ul id="menu">
<li <?php if(is_home()) { ?> class="current-cat"< ?php } ?>>
<a href="<?php bloginfo('home'); ?>">Home</a></li>
< ?php wp_list_categories('title_li=&orderby=id'); ?>
</ul>
Pages based Navigation
<ul id="menu">
<li <?php if(is_home()) { ?> class="current_page_item"< ?php } ?>>
<a href="<?php bloginfo('home'); ?>">home</a></li>
< ?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
</ul>

Popular Articles