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_author' => 1,
'post_content' => '[mailpoet_page]',
'post_title' => '[mailpoet_title]',
'post_title' => __('MailPoet Page'),
'post_name' => 'subscriptions'
));
flush_rewrite_rules();

View File

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