Continuing with the topic of wordpress theme programming today, I will introduce you to the commonly used functions in wordpress. These functions are present in almost all themes.
Knowing these functions will make it easier for you to get started with wordpress theme programming as well as be able to actively change some elements of the theme.

Contents
The bloginfo() and get_bloginfo() functions
This is a function to get some available information of the website. For example: Website title, website URL, theme link…
The information returned depends on the parameters that we pass to this function specifically as follows:
- bloginfo(‘name’) : Displays the name of the site – e.g. Learn WordPress
- bloginfo(‘siteurl’) : Display home page URL Website address – for example: https:///
- bloginfo(‘description’) : Displays the description of the site – e.g. wordpress tutorial – wordpress course
- bloginfo(‘wpurl’) : Displays the url of the website that is set to the url from the database’s wp_options table – for example: https:///
- bloginfo(‘url’) : Displays the address of the Web page – for example, https:// . vn /
- bloginfo(‘admin_email’) : Show Admin Email set up in Settings > General
- bloginfo(‘charset’) : Displays the Charset Encoding type of the website for example “UTF-8”
- bloginfo(‘version’) : Displays the current WordPress version in use
- bloginfo(‘html_type’) : Displays the default WordPress Content Type of “text/html”
- bloginfo(‘language’) : Displays the language the site is using
- bloginfo(‘stylesheet_url’) : Display the address to the file style.css
- bloginfo(‘stylesheet_directory’) : Displays the link to the current theme directory
- bloginfo(‘rss_url’) : Show RSS address 0.92 feed
- bloginfo(‘rss2_url’) : Show the RSS 2.0 feed
The bloginfo () function when running this function will automatically print the data, and the get_bloginfo () function, to print it out, we need to echo for example: <?php echo get_bloginfo(‘name’); ?>
These functions correspond to get the content of the following 3 files in the theme:
- get_header() get the contents of the file header.php
- get_footer() get the contents of the file footer.php
- get_sidebar() get the content of the file sidebar.php
These functions all have slug parameters, to get the content of the subfiles, for example:
get_header(‘child’) will get the contents of the header-child.php file . The same is true for the other two functions.
In addition, to get the content of any file in wordpress theme programming, we can use the get_template_part () function, for example as follows:
- get_template_part(‘slider’) will get the content of the slider.php file in the theme.
- get_template_part(‘content/gird’) will get the content of the grid.php file in the theme’s content directory.
These are two simple functions that are extremely important in wordpress theme programming. If it is missing, it can lead to some website functions or plugins not working.
wp_head() function
The wp_head () function is usually placed at the head of the website (in the <head></head> tag pair ). This function has the function of adding default wordpress components as well as wordpress plugins.
For example: We use the wordpress seo plugin , this function will add meta tags to help the website standard seo.
The wp_footer () function has the function of adding elements to the bottom of the website such as embedding plugin js snippets into the website.
This function also helps create the admin bar for the website when we login to the website.

In order for the admin bar to appear outside the interface when logging in, we must use wp_footer()
Some conditional functions in theme programming:
- comments_open( $args ) Checks whether the comment function of the current post is open or not.
- has_tag( $args ) Checks whether the current post has a tag set or not.
- has_term ( $args ) Checks whether the current post contains a term of any taxonomy. For example, if you have a category named ABC, that ACB is the term of the taxonomy named Category.
- in_category( $args ) Checks if the current post is in any category.
- is_404() Checks if the page you are visiting has a 404 error.
- is_admin() Checks if you are accessing the WordPress admin page.
- is_archive() Checks if you are accessing the archive page of any taxonomy.
- is_attachment() Checks if you are accessing the page showing attachments in the post (Media).
- is_author( $args ) Checks if you are viewing an author’s archive page.
- is_child_theme() Checks if the current theme in use is a child theme or a normal theme.
- is_comments_popup() Checks if the page you are currently on is the comment popup page.
- is_date() Checks if the current page is a date archive.
- is_day() Checks if the page you are viewing is a date archived page.
- is_feed() Checks if the object you are viewing belongs to the RSS Feed page.
- is_front_page() Checks if the current page you are viewing is the homepage that was set up in Settings -> Reading.
- is_home() Checks if your current page is the home page. The result will return TRUE if you do not set the home page in Settings -> Reading or you set a page to be Post page in Settings -> Reading.
- is_month() Checks whether the page being viewed is an archived page.
- is_multi_author() Checks if the website you are visiting has more than one author.
- is_multisite() Checks if the current site is a WordPress Multisite.
- is_main_site( $args ) Checks if the current site is the main site in the WordPress Multiste network.
- is_page( $args ) Checks whether the current page belongs to Page or not.
- is_page_template( $args ) Checks whether the current page uses a Page Template.
- is_paged() Checks if the current page is paginated. Not applicable to Posts and Pages.
- is_preview() Checks if the page you are viewing is a preview of the article in draft mode.
- is_rtl() Checks whether the language being used for the website belongs to the list of countries that use the right-left page layout. For example, Arabic will read from right to left.
- is_search() Checks whether the page being viewed is the one showing search results.
- is_single( $args ) Checks if the current page is the content detail page of any post type. Only applies to post types whose Hierarchical parameter is True, ie like Post.
- is_singular( $args ) Checks if the current page is the content detail page of any post type, it’s the same as is_single() but applies to all post types and it will return the result is TRUE if is_single(), is_page() and is_attachment() return TRUE.
- is_sticky( $args ) Checks if the currently viewed post is highlighted on the Sticky button.
- is_super_admin( $args ) Checks whether the user is Super Admin or not.
- is_tag( $args ) Checks if the current page is the page displaying the list of posts for a given tag.
- is_tax( $args ) Returns TRUE if the current page is the page displaying the list of articles of a certain taxonomy.
- username_exists( $args ) Checks the existence of a username.
- is_taxonomy_hierarchical( $args ) Checks whether a certain taxonomy has hierarchical enabled.
- is plugin active( $args ) Returns TRUE if a certain plugin is active.
- in_the_loop() Checks if the current object is in the loop.
- is_activate_sidebar( $args ) Checks if a certain sidebar is in use.
- is_activate_widget( $args ) Checks if a certain widget is in use (putting in the sidebar).
- is_dynamic_sidebar() Checks the sidebar to see if it has a widget added.
- is_user_logged_in() Checks whether the viewer is a logged in member or not.
- wp_is_mobile() Checks whether the device being accessed is a mobile phone or not.
Summary:
Today I have introduced to you about the commonly used functions in wordpress theme programming. These are the initial knowledge for familiarization as well as easy access to creating themes later.
The next article we will learn about the topic of get post loop in wordpresss.
