Skip to content

Instantly share code, notes, and snippets.

@mkormendy
Last active February 22, 2021 14:23
Show Gist options
  • Save mkormendy/bf71cd43dae650911e30 to your computer and use it in GitHub Desktop.
Save mkormendy/bf71cd43dae650911e30 to your computer and use it in GitHub Desktop.
WordPress Cheatsheet

##Theme Structure

Template Description
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

##The Loop // The Stuff... Custom HTML & PHP Code

##The Category Based Loop // The Stuff... Custom HTML & PHP Code

##Theme Definition /* Theme Name: Wordpress Theme URI: http://wordpress.org/ Description: Test Blog Version: 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

Template Description
Displays the posts/pages title
Displays the content of the post/page
Displays the excerpt of the current post/page
Displays the time of the current post/page
Displays the date of a post or set of post/page
Displays the URL for the permalink
Displays the category of a post
Displays the author of the post
Displays the numeric ID of the current post
Displays all the pages
Displays a tag cloud
Displays the categories
Displays the calendar
Displays a date-based archives list
Displays Previous page and Next Page links
Displays Newer Posts link
Displays previous link
Displays the edit link
Value for search form
Displays the register link
Displays the log in/out link
Meta for administrators
Time to load the page
Displays the custom field
Display links from Blogroll
Displays the built-in calendar
Link of the posts comments

##BlogInfo Tags

Template Tag Description
Title of the blog
The character set
The description of the blog
The address of the blog
The RSS URL
The URL of the template
The pingback URL
The URL for the template's CSS file
URL for WordPress installation
Version of the WordPress installation
HTML version of the site

##Conditional Tags

Template Tag Description
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

    <li class="current-cat"< ?php } ?>> Home

###Pages based Navigation

    <li class="current_page_item"< ?php } ?>> home < ?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment