I'm using the contactform 7 plugin and i want to add the title of the last viewed page (The page visited before the contact) to the dynamic field of the plugin with a shortcode. Is there a way to do that?

I found this plugin Last Viewed Posts to display the last visited post. But I can't found a solution to add this to the dynamic field of my contactform.

Would be very nice if someone could help me.

Thanks, Oli


I think the best way to do this would be to use the Contact Form 7 Dynamic Text Extension, and then pre-populate the URL to the Contact Form page with the current post title. More details on how to do that in my answer here. The code to pre-populate the link in a post template would look something like:

<a href="<?php echo get_page_link(58); ?>&foo=<?php single_post_title(); ?>">Contact Form</a>
  • Hey, thanks for helping! :) With get_page_link(58) have to now the Id of the actual page. Is this right? The Problem here is that my posts are dynamic. So I can't now the ID of the post. – oBear Nov 23 '11 at 8:38

Ok, i got it now! Like GavinR recommended I'm using now the Contact Form 7 Dynamic Text Extension

A very nice tutorial how to work with the plugin can be found here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.