WordPress.org

Ready to get started?Download WordPress

Forums

[Grunion Contact Form] How to place shortcode in template? (2 posts)

  1. do77
    Member
    Posted 3 years ago #

    Hi,

    I have been trying to place the shortcode [contact-form] in my single.php so author's don't always have to add the shortcode to their posts manually.

    I added <?php do_shortcode('[contact-form]');?> right after the_content within the loop but the contact form does not show up.

    Any idea why that is or can anyone give me a hint on how to do it right!?

    I appreciate your help!!
    do77

  2. spideyrag
    Member
    Posted 3 years ago #

    I was succesful in showing the form on the blog post from single.php but in the to field, i could not generate the author email dynamically.

    need help in this.

    <?php echo do_shortcode('[contact-form subject="My Blog" to="<?php echo the_author_email() ?>"] [contact-field label="Name" type="name" required="true" /] [contact-field label="Email" type="email" required="true" /] [contact-field label="Contact Number" type="text" required="true" /] [contact-field label="Comment" type="textarea" required="true" /] [/contact-form] '); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic