This article presents some terms that are commonly used when working with WordPress.

page

A “page” is a webpage. So this could be your site’s homepage or an inner page.

Page

Notice the capitalization in Page.

A “Page” is a static Page. You can see the list of all Pages in your site by clicking on Pages in the WordPress admin.

Homepage

Homepage or front page is what it says.

By default, what appears on the Homepage (or homepage, capitalization of the first alphabet does not matter here) in WordPress is a list of blog posts.

Static homepage

When a static Page is set as homepage at Settings > Reading, your site is set to have a static homepage.

Posts page

Out of the box, the list of blog posts or the blog posts index appears on your site’s homepage. But this can be set to an inner page by designating a static Page as the Posts page at Settings > Reading.

Single Post

This is any single blog post when being viewed on the front end.

Entry

This can be a post or a Page or a CPT post.

Archive

This is any page that shows more than 1 entry out of the box. The various archives in WordPress are category archives, tag archives, CPT archives, taxonomy archives, search archives, date archives and author archives.

Query

Every WordPress page will have a built-in query object. This contains information on what should be shown.

It is NOT recommended to alter the main query of archives if it can be avoided.

Loop

This defines how the query should be shown.

We can add our own custom (or secondary) query + loop as many times as needed in WordPress.

Sample code:

<?php

// WP_Query arguments.
$args = array(
	'post_type' => array( 'testimonial' ),
	'no_found_rows' => true, // when pagination is not needed.
);

// The Query.
$query = new WP_Query( $args );

// The Loop.
if ( $query->have_posts() ) {
	while ( $query->have_posts() ) {
		$query->the_post();
		// do something.
		the_title();
	}
} else {
	// no posts found.
}

// Restore original Post Data.
wp_reset_postdata();

?>

References

https://10up.github.io/Engineering-Best-Practices/php/

https://generatewp.com/wp_query/

https://gist.github.com/luetkemj/2023628#file-wp-query-ref-php

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: