Restricting content to the first page of the blog


show more Restricting content to the first page of the blog provides you with in-depth training on Web. Taught by Morten Rand-Hendriksen as part of the WordPress 3: Building Child Themes show less
please wait ...

Restricting content to the first page of the blog

In many cases, you want to restrict certain content or behaviors to a particular page or post in your site. This is relatively easy when it comes to pages or posts, because you're dealing with single items. But what do you do from the page in question is an index page. We can't test for a specific post id, because the post keeps changing. Instead, we have test to see if the currently displayed template is the one we want and that it is in the order we want it to be in. Let me explain what I am talking about here.

We added a welcome message to our index template. It displays at the very top of the index template and then underneath you have the index content. However, if I scroll down, and I jump to Page 2 of the index, the welcome message still appears. Logically, we only want the welcome message to appear on the front page, so Page number 1 of the index template. So how do we do that? Well, we have to ask WordPress several questions. We both have to ask it, is this the front page that you are...

Restricting content to the first page of the blog
Video duration: 4m 22s 3h 11m Intermediate Updated Nov 27, 2012

Viewers:

Restricting content to the first page of the blog provides you with in-depth training on Web. Taught by Morten Rand-Hendriksen as part of the WordPress 3: Building Child Themes

Subject:
Web
Software:
WordPress
Author:
please wait ...