Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
411 views
in Technique[技术] by (71.8m points)

wordpress - How to create mailto that populates subject post/product title

I have a woocommerce site and want to have a mailto button for more information. I want the email to automatically populate the subject field with the product (post) title. I have found various options using php but nothing seems to work.

I have tried using the following mailto:

mailto:[email protected]?subject=Info request for [custom_mailto_title]

and then this php:

add_shortcode( 'custom_mailto_title', 'custom_mailto_title' ); 
function custom_mailto_title( $atts ) {
return esc_attr( get_the_title( get_the_ID() ) );
}

It looks like it should work but it doesn't and my understanding of php is limited

question from:https://stackoverflow.com/questions/65871284/how-to-create-mailto-that-populates-subject-post-product-title

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...