• Resolved metador

    (@metador)


    Is it possible somehow to make Email button, that when clicked it would show not the link to the post in the email body, but all the post content itself. Something like this:

    I know you can customize Email template like:
    HERE
    But as I understand there are variables only for title and the url.

    • This topic was modified 7 years, 9 months ago by metador.
    • This topic was modified 7 years, 9 months ago by metador.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author micropat

    (@micropat)

    URLs are limited to around 2,000 characters, so don’t put an entire post in the email body.

    Using AddToAny events you can customize the email template body like:

    a2a_config.templates.email = {
    	subject: '${title}',
    	body: '${link}'
    };
    
    function my_addtoany_onshare(share_data) {
    	// Get the first paragraph in the post
    	var post_content = document.querySelector('.entry-content p');
    	
    	if ( post_content ) {
    		// Truncate and use in the email body
    		a2a_config.templates.email.body = 
    			post_content.textContent.substring(0, 1000).trim() + 
    			'\n\nRead more here: ${link}';
    		
    		return share_data;
    	}
    }
    
    a2a_config.callbacks.push({
    	share: my_addtoany_onshare
    });

    You may need to change the element you get text from (.entry-content p) because the post elements may vary from theme to theme.

    Thread Starter metador

    (@metador)

    Thank you for taking your time answering this! I really really appreciate your help, hope someone will find this helpful too.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Email button and content’ is closed to new replies.