The Most Common WordPress Functions

Last updated: WordPress 3 min read
WordPress is the prevailing content management system (CMS) platform for various types of websites. It’s user-friendly and highly customizable, making it a popular choice at TheeDigital for client projects. This post lists common PHP codes used in custom WordPress theme development. We provide a basic overview of how to incorporate these functions into your WordPress site, and you’ll need access to a WordPress site to follow along.
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:
  1. 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.
  2. 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 AppearanceEditor section to view the relevant WordPress files.
  3. 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.
The first line of the index.php template might look have this piece of code: <?php get_header(); ?>. That’s simply snippet of code that says “Place the header content at the top of this page.” In another file, one that is commonly named header.php, there’s code that specifies what the header actually contains. If you’re still in the Editor section of WordPress, you can select header.php from the list on the right to see how that is built. That should be enough to whet your appetite! Below you will find more useful code snippets commonly used in WordPress.
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

Richard Horvath

Owner / President

Richard Horvath is the founder of TheeDigital, a Raleigh based award-winning web design and digital marketing agency. He is proud of his team and the results that they provide to their clients.

Related Posts

How to Update Your WordPress Plugins Safely
Support 8 min read

How to Update Your WordPress Plugins Safely

Running a WordPress site? Then getting your head around plugin updates is key. Think of these updates…
Richard Horvath

How to create a new gravity form
Our Favorites 5 min read

Gravity Forms – How to Create a New Form

Here you'll learn how to create and edit a Gravity Form on your site.
Richard Horvath

Top WordPress Web Development Trends for 2023
WordPress 4 min read

Top WordPress Web Development Trends for 2024

What's going to be big on Wordpress next year? Read on to discover what's new.
Melissa Read

What are Wireframe Mockups?
Web Design 2 min read

Wireframes for Custom-Designed Wordpress Sites

Utilizing Wireframing to ensure a stand out website design is vital. But Wireframes can be confusing. Learn…
Melissa Read

Schedule a Consultation