replace mailpoet_title 'hack' by checking the post type

This commit is contained in:
Jonathan Labreuille
2016-03-17 15:43:22 +01:00
parent f38b632707
commit 20ced8b099
2 changed files with 6 additions and 10 deletions

View File

@@ -33,7 +33,7 @@ class Pages {
'post_type' => 'mailpoet_page', 'post_type' => 'mailpoet_page',
'post_author' => 1, 'post_author' => 1,
'post_content' => '[mailpoet_page]', 'post_content' => '[mailpoet_page]',
'post_title' => '[mailpoet_title]', 'post_title' => __('MailPoet Page'),
'post_name' => 'subscriptions' 'post_name' => 'subscriptions'
)); ));
flush_rewrite_rules(); flush_rewrite_rules();

View File

@@ -64,14 +64,10 @@ class Pages {
return $meta; return $meta;
} }
function setPageTitle($page_title = '[mailpoet_title]') { function setPageTitle($page_title = '') {
if( global $post;
(strpos($page_title, '[mailpoet_title]') === false)
&& if($post->post_type === 'mailpoet_page') {
(strlen(trim($page_title)) > 0)
) {
return $page_title;
} else {
$subscriber = $this->getSubscriber(); $subscriber = $this->getSubscriber();
switch($this->getAction()) { switch($this->getAction()) {
case 'confirm': case 'confirm':
@@ -93,7 +89,7 @@ class Pages {
break; break;
} }
} }
return str_replace('[mailpoet_title]', $title, $page_title); return $page_title;
} }
function setPageContent($page_content = '[mailpoet_page]') { function setPageContent($page_content = '[mailpoet_page]') {