Some of the primitive WordPress tags you might have forgotten

Ujjwal ShresthaUjjwal Shrestha
4 min read

WordPress uses a wide range of template tags, conditional tags, post-related tags, and other miscellaneous tags for theme development and content management. Here's an extensive list of the tags used in WordPress:
Template Tags

  1. Header and Footer
  • <?php get_header(); ?> - Includes the header template.

  • <?php get_footer(); ?> - Includes the footer template.

  • <?php get_sidebar(); ?> - Includes the sidebar template.

  • <?php get_template_part(); ?> - Includes a specific template part file.

  1. Navigation
  • <?php wp_nav_menu(); ?> - Displays a custom navigation menu.

  • <?php next_post_link(); ?> - Displays a link to the next post.

  • <?php previous_post_link(); ?> - Displays a link to the previous post.

  • <?php posts_nav_link(); ?> - Displays navigation links for paginated posts.

  • <?php paginate_links(); ?> - Displays pagination links.

  1. Content
  • <?php the_content(); ?> - Displays the content of the post or page.

  • <?php the_excerpt(); ?> - Displays the post excerpt.

  • <?php the_title(); ?> - Displays the title of the post or page.

  • <?php the_ID(); ?> - Displays the ID of the post.

  • <?php the_permalink(); ?> - Returns the URL of the post or page.

  • <?php the_author(); ?> - Displays the author of the post.

  • <?php the_date(); ?> - Displays the date the post was published.

  • <?php the_category(); ?> - Displays the categories of the post.

  • <?php the_tags(); ?> - Displays the tags of the post.

  • <?php the_post_thumbnail(); ?> - Displays the post thumbnail (featured image).

  • <?php edit_post_link(); ?> - Displays an edit post link if the user has permission to edit the post.

Conditional Tags

  1. is_home() - Checks if the main blog page is being displayed.

  2. is_front_page() - Checks if the site’s front page is being displayed.

  3. is_single() - Checks if a single post of any post type is being displayed.

  4. is_page() - Checks if a specific page or any page is being displayed.

  5. is_category() - Checks if a category archive is being displayed.

  6. is_tag() - Checks if a tag archive is being displayed.

  7. is_author() - Checks if an author archive is being displayed.

  8. is_search() - Checks if a search results page is being displayed.

  9. is_404() - Checks if a 404 error page is being displayed.

  10. is_archive() - Checks if any type of archive page is being displayed.

  11. is_attachment() - Checks if an attachment page is being displayed.

  12. is_singular() - Checks if a single post of any post type is being displayed (includes single posts, pages, attachments).

  13. is_sticky() - Checks if a post is marked as "sticky".

  14. is_paged() - Checks if the query is for a paged result and not for the first page.

  15. is_preview() - Checks if a post is being displayed in preview mode.

Post-related Tags

  1. the_post() - Sets up global post data.

  2. have_posts() - Checks if there are posts available.

  3. wp_link_pages() - Displays page links for paginated posts.

  4. the_author_meta() - Displays the meta information for the author of the post.

  5. the_date_xml() - Displays the date in XML format.

  6. the_shortlink() - Displays the shortlink for the post.

  7. the_post_navigation() - Displays navigation to next/previous post.

Miscellaneous Tags

  1. bloginfo('name') - Displays the site name.

  2. bloginfo('description') - Displays the site tagline or description.

  3. bloginfo('url') - Displays the site URL.

  4. wp_title() - Displays the title of the page.

  5. language_attributes() - Outputs the language attributes for the HTML tag.

  6. wp_head() - Outputs necessary head content.

  7. wp_footer() - Outputs necessary footer content.

  8. body_class() - Adds classes to the <body> tag.

  9. post_class() - Adds classes to the <article> tag for the post.

  10. wp_meta() - Displays the meta widget content.

  11. wp_get_archives() - Displays archive links.

  12. get_calendar() - Displays a calendar.

  13. get_search_form() - Displays the search form.

  14. comments_template() - Includes the comments template.

  15. comment_form() - Displays the comment form.

  16. wp_list_comments() - Lists the comments for a post.

  17. wp_login_form() - Displays the login form.

  18. wp_register() - Displays the register link.

  19. wp_loginout() - Displays the login/logout link.

  20. wp_logout_url() - Returns the logout URL.

  21. wp_lostpassword_url() - Returns the lost password URL.

  22. wp_register_url() - Returns the register URL.

Custom Query and Loop Tags

  1. query_posts() - Modifies the main query.

  2. wp_reset_query() - Resets the main query.

  3. wp_reset_postdata() - Resets the global post data.

These tags are essential for developing WordPress themes and customizing the behavior and appearance of your site. They enable you to dynamically generate and control content, navigation, and other elements within your WordPress site.

0
Subscribe to my newsletter

Read articles from Ujjwal Shrestha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ujjwal Shrestha
Ujjwal Shrestha

Hi! My name is Ujjwal Shrestha and I'm a Junior PHP/WordPress developer. Learning and gaining experience in the field, I have a strong track record of delivering clean, high-quality solutions for my clients, and have the skills and expertise to take on projects of any size and complexity.