-
AuthorPosts
-
January 25, 2016 at 10:24 am #571190
Hi,
I have been trying to get a e-mail link to show the title page for each of the client painting and have been using the below:
<a href="mailto: (Email address hidden if logged out) ?subject=<?php echo get_the_title(); ?>">E-MAIL LINK LINK TEXT</a>
However I cant get it to work can you help. If you goto http://www.peter-test3.co.uk/art-portfolio-item/distant-farm-buildings/ at the bottom of the page there is a link that says
E-MAIL LINK LINK TEXT if you click on here you can see waht I mean can you help please
Pete
- This topic was modified 8 years, 11 months ago by condonpb.
January 26, 2016 at 1:29 am #571750Hi condonpb!
Please use a plugin such as this one – https://wordpress.org/plugins/insert-php/ to insert PHP in your content
Best regards,
YigitJanuary 26, 2016 at 10:33 am #571996Yigit
I have tried this with plugin but still does not work. Have tried
<a href="mailto: (Email address hidden if logged out) ?subject=[insert_php] echo get_the_title(); [/insert_php]">E-MAIL LINK LINK TEXT</a>
Please see: http://www.peter-test3.co.uk/art-portfolio-item/ana-bianchi-whistledown-farm/
E-MAIL LINK LINK TEXT if you click on here you can see what I mean can you help please
I have also left login details if that helps for wordpressJanuary 27, 2016 at 11:25 pm #573310Hi!
I’d suggest creating a custom shortcode for this, like (theme / child theme functions.php):
function custom_shortcode_func() { global $post; ob_start(); ?> <a href="mailto: (Email address hidden if logged out) ?subject=<?php echo get_the_title($post->ID); ?>">E-MAIL LINK LINK TEXT</a> <?php $output = ob_get_clean(); return $output; } add_shortcode('my_shortcode', 'custom_shortcode_func');
And then use
[my_shortcode]
.Best regards,
JosueFebruary 5, 2016 at 12:43 am #578130Josue,
Thanks for this it works if I want to add another link with different description what would i need to add to this code in the file i.e
my_shortcode = ID); ?>”>Enquire about this painting
my shortcode1= ID); ?>”>Enquire about this sculpture
February 5, 2016 at 4:19 am #578208Hey!
Try the following:
function custom_shortcode_func() { global $post; ob_start(); ?> <a href="mailto: (Email address hidden if logged out) ?subject=<?php echo get_the_title($post->ID); ?>">LINK 1</a> <a href="mailto: (Email address hidden if logged out) ?subject=<?php echo get_the_title($post->ID); ?>">LINK 2</a> <?php $output = ob_get_clean(); return $output; } add_shortcode('my_shortcode', 'custom_shortcode_func');
Best regards,
JosueFebruary 7, 2016 at 1:13 am #579081Josue,
I am not sure you have understood this. Sorry I probably was not clear.
On the website there are some different type of posts some are post of images of sculptures, and some are posts with images of paintings.
So on each post type ie scultpure or paintings there needs to be only one link for each type.
So for the paintings posts we would use one shortcode 1 which would use `?>
<a href=”mailto: (Email address hidden if logged out) ?subject=Enquiry on Paintings<?php echo get_the_title($post->ID); ?>”>Enquire about this painting</a>
<?php`
and for the scultpure posts we would use shortcode 2 which would use `?>
<a href=”mailto: (Email address hidden if logged out) ?subject=Enquiry on Scuptures<?php echo get_the_title($post->ID); ?>”>Enquire about this sculpture</a>
<?php`I hope this is clearer.
Many Thanks
Pete
- This reply was modified 8 years, 10 months ago by condonpb.
February 7, 2016 at 10:07 pm #579256Hi Pete!
In that case you’d just need to duplicate and modify the function code i gave you for the first shortcode (make sure you change the function and shortcode name).
Best regards,
JosueFebruary 8, 2016 at 5:51 pm #579785Many Thanks
This can now be closed
Pete
-
AuthorPosts
- The topic ‘Mailto and picking up Title of Page in Subject’ is closed to new replies.