Why are you comparing $post->post_name
to $this->title
? You should be comparing slug to slug.
Try changing your comparison from this:
if( strtolower( $page->post_name ) == strtolower( $this->title ) )
…to this:
if( strtolower( $page->post_name ) == strtolower( $this->slug ) )
Also, I might suggest keeping with the WordPress object conventions with your dynamically created pages, as doing so might help avoid such confusion.
I would change this:
$cdArray = array( 'title' => 'Biography', 'slug' => 'concert-diary' );
…to this:
$cdArray = array( 'title' => 'Biography', 'post_name' => 'concert-diary' );
And then change this:
public function __construct( $nameArray ) {
$this->title = $nameArray['title']; //Title of the page
$this->slug = $nameArray['slug']; //Page slug
}
…to this:
public function __construct( $nameArray ) {
$this->title = $nameArray['title']; //Title of the page
$this->post_name = $nameArray['post_name']; //Page slug
}
So that your comparison becomes this:
if( strtolower( $page->post_name ) == strtolower( $this->post_name ) )
That might help you avoid some confusion.