The Most Common WordPress Functions | |
---|---|
Title of the site | <?php bloginfo(‘title of my site’); ?> |
Title of specific post or page | <?php wp_title(); ?> |
The style.css file’s theme location | <?php bloginfo(‘stylesheet_ url’); ?> |
Pingback URL for the site | <?php bloginfo(‘pingback_url’); ?> |
Location for the site’s theme file | <?php bloginfo(‘template_url’); ?> |
Wordpress version for the site | <?php bloginfo(‘version’); ?> |
Atom URL for the site | <?php bloginfo(‘atom_url’); ?> |
Exact URL for the site | <?php bloginfo(‘rss2_url’); ?> |
Name of the site | <?php bloginfo(‘name’); ?> |
Html version of the site | <?php bloginfo(‘html_type’); ?> |
Charset parameter of the site | <?php bloginfo(‘charset’); ?> |
Author of a specific post or page | <?php the_author(); ?> |
ID of a specific post or page | <?php the_ID(); ?> |
Link to edit a specific post or page | <?php edit_ post_link(); ?> |
Links from the blogroll | <?php get_links_ list(); ?> |
Comment.php file’s content | <?php comments_template(); ?> |
List of pages of the site | <?php wp_ list_pages(); ?> |
List of categories for the site | <?php wp_ list_cats(); ?> |
URL to the next post | <?php next_ post_link(‘%link’) ?> |
URL to the previous post | <?php previous_post_link(‘%link’) ?> |
The built-in calendar | <?php get_calendar(); ?> |
List of archives for the site | <?php wp_get_archives() ?> |
Next and previous post link | <?php posts_nav_link(); ?> |
Site’s description | <?php bloginfo(‘description’); ?> |
Content of the posts | <?php the_content();?> |
Checks if there are posts | <?php if(have_posts()) : ?> |
Shows posts if posts are available | <?php while(have_posts()) : the_post(); ?> |
Closes the ‘while’ PHP function | <?php endwhile; ?> |
Closes the ‘if’ PHP function | <?php endif; ?> |
Header.php file’s content | <?php get_header(); ?> |
Sidebar.php file’s content | <?php get_sidebar(); ?> |
Footer.php file’s content | <?php get_footer(); ?> |
The date in ’06-21-11′ format | <?php the_time(‘m-d-y’) ?> |
Link for the comments on the post | <?php comments_popup_link(); ?> |
Title of a specific post or page | <?php the_title ();?> |
URL of a specific post or page | <?php the_permalink() ?> |
Category of a specific post or page | <?php the_category(‘,’) ?> |
How to Use WordPress Functions
One strength of WordPress that has contributed to its widespread use is its intuitive user interface for content producers mixed with enough configuration options for any serious developer to tailor the CMS to meet unique needs. The WordPress functions listed above are provided by WordPress and can be used when developing a WordPress theme, but WordPress is extensible and allows for custom functions to be written. Fortunately, in many cases, the functions that WordPress provides are more than enough to build or change a business or organization website. If you’re creating your own custom WordPress theme, or you want to know how to edit one that you already have installed, then perform these steps:- Log into your WordPress site. A common place to do that is at: www.your-wordpress-site.com/wp-admin However, the exact location of the WordPress login page will depend on how your site was set up.
- Once logged into WordPress, you will see a page called the Dashboard. On the left side should be a navigation menu, and you’ll want to find the Appearance → Editor section to view the relevant WordPress files.
- The Editor page will have a list of files you can view and edit on the right side. To get started, you can choose index.php from that list by clicking on it.
Additional Useful WordPress Code Snippets | |
---|---|
Custom permalinks | /%postname%/ |
Include any file | <?php include(TEMPLATEPATH .’/x’); ?> |
Value for search form | <?php the_search_ query(); ?> |
Prints out message | <?php _e(‘Message’); ?> |
Displays the register link | <?php wp_register(); ?> |
Displays the login/logout link | <?php wp_loginout(); ?> |
Divides the content into pages | <!–next page–> |
Cuts off the content | <!–more–> |
Meta for administators | <?php wp_meta(); ?> |
Time to load the page | <?php timer_stop(1); ?> |
Queries to load the page | <?php echo get_num_queries(); ?> |
If you aren’t familiar with WordPress, give it a try by installing it on your own computer. Or if you need assistance making your website vision a working reality – contact one of our WordPress designers at TheeDesign in Raleigh, NC at 919-341-8901 or schedule a consultation to get the project started for you.
Tags: WordPress