Wordpress - if ( is_home() && ! is_front_page() )

Here is how to do it right:

if ( is_front_page() && is_home() ) {
// Default homepage

} elseif ( is_front_page()){
// Static homepage

} elseif ( is_home()){

// Blog page

} else {

// Everything else

}

This is the only (right) way to display or alter content with your homepage and your blog page.


This will display the title of the page when a static page is set to show posts.

E.g.

I show posts on my homepage... It'll do nothing.

If I, say, show posts on page titled News... It'll show News in H1.

This is used so that the title of the page is shown, whenever posts are shown on a page, but nothing when blog posts are shown on the front page (home page).

We do it because if it's on home page... it will show the title of the first post, making it appear twice (once at the top in H1 and again when posts are looped through).


I am not sure about "popular", it doesn't seem so to me (but then I don't look at that many themes).

You seem to grasp fine what each conditional does, so this shouldn't be confusing to you. This combines conditions to check that blog index is being displayed and it's not at the front page.

Ah, the reason for single_post_title() I would guess is that it displays title for $wp_query->queried object (set up by main query as current context), rather than $post global (set up by iterating loop).

In some circumstances these will be same, but not in such case as condition checks for. The loop will contain posts, but queried object will be page (unless I am mixing things up :).