- Minor adjustment to the shortcodes logic
This commit is contained in:
@ -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 . '>';
|
||||
}
|
||||
}
|
||||
|
@ -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':
|
||||
|
@ -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']}.
|
||||
|
Reference in New Issue
Block a user