Notifications
Clear all

[Closed] Custom Shortcode use in Email body and subject

5 Posts
2 Users
0 Reactions
621 Views
Posts: 8
Topic starter
(@blueli)
Active Member
Joined: 2 years ago

Hello. I am wondering if we could create our custom shortcode and use it for the email body?

Example. I have a shortcode [email_footer_logo] with a function to return a png file. Something like this. (I am planning a add a option for ACF option page. So the site manage can edit it from option page.

return '<p style="text-align: left;"><img src="https://example.com/wp-content/uploads/2022/11/vs-email-footer-logos.png" style="max-width: 520px; width: 100%; height: auto";/></p>';
}

 

However. When I placed it into the email body. It does not return anything. 

Plus. I like to use TranslatePress Shortcode for translating email body, I use this way with Woocommerce Email and it works. Their shortcodes are ike:
[trp_language language="en_HK"]
Content here will be only for en_HK visitor
[/trp_language]

[trp_language language="zh_HK"]
Content here will be only for zh_HK visitor
[/trp_language]

These shortcode wraps do not work either... 

Any workaround we can add support to this?

 

Thanks

4 Replies
Chris
Posts: 3627
(@chris)
Famed Member
Joined: 3 years ago

Hi @blueli,

Are those WordPress Shortcodes ? If yes, we can add them.

Posts: 8
Topic starter
(@blueli)
Active Member
Joined: 2 years ago

Yes it is WordPress Shortcodes I guess?

The shortcodes are added via add_shortcode()

FYI

add_shortcode( 'email_footer_logo', 'email_footer_logo');

function email_footer_logo() {
return '<p style="text-align: left;"><img src="https://example.com/wp-content/uploads/2022/11/vs-email-footer-logos.png" style="max-width: 520px; width: 100%; height: auto";/></p>';
}

 

Thanks

Chris
Posts: 3627
(@chris)
Famed Member
Joined: 3 years ago

Hi @blueli,

We have added WordPress shortcode for the new version of wpForo.

Posts: 8
Topic starter
(@blueli)
Active Member
Joined: 2 years ago

Thanks! That is fast, will test it later today!