- Minor adjustment to the shortcodes logic

This commit is contained in:
Vlad
2016-03-20 11:37:59 -04:00
parent 6ec15bec22
commit 42c4139ba5
3 changed files with 6 additions and 6 deletions

View File

@ -169,6 +169,6 @@ class PostTransformer {
$alignment = (in_array($this->args['titleAlignment'], array('left', 'right', 'center'))) ? $this->args['titleAlignment'] : 'left';
return '<' . $tag . ' class="mailpoet_alc_post" style="text-align: ' . $alignment . '">' . $title . '</' . $tag . '>';
return '<' . $tag . ' data-post-id="' . $post->ID . '" style="text-align: ' . $alignment . '">' . $title . '</' . $tag . '>';
}
}

View File

@ -42,7 +42,7 @@ class Newsletter {
break;
case 'total':
return substr_count($text, 'mailpoet_alc_post');
return substr_count($text, 'data-post-id');
break;
case 'post_title':

View File

@ -27,8 +27,8 @@ class ShortcodesTest extends MailPoetTest {
Thank you for subscribing with [user:email].
We already have [user:count] users.
<h1 class="mailpoet_alc_post">some post</h1>
<h1 class="mailpoet_alc_post">another post</h1>
<h1 data-post-id="1">some post</h1>
<h1 data-post-id="2">another post</h1>
There are [newsletter:total] posts in this newsletter.
You are reading [newsletter:subject].
@ -87,8 +87,8 @@ class ShortcodesTest extends MailPoetTest {
Thank you for subscribing with {$this->subscriber->email}.
We already have {$subscriber_count} users.
<h1 class=\"mailpoet_alc_post\">some post</h1>
<h1 class=\"mailpoet_alc_post\">another post</h1>
<h1 data-post-id=\"1\">some post</h1>
<h1 data-post-id=\"2\">another post</h1>
There are {$number_of_posts} posts in this newsletter.
You are reading {$this->newsletter['subject']}.