For the special mail tags fetching [_post_*] data to work they must be inside the post / page's content.
However, my form is in the template files. Is there any way to use the [_post_*] when the form is outside of the the_content ?
Thanks!
For the special mail tags fetching [_post_*] data to work they must be inside the post / page's content.
However, my form is in the template files. Is there any way to use the [_post_*] when the form is outside of the the_content ?
Thanks!
Place <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ); ?> code inside the loop.
I use my form inside an if statement, so I placed it before the endwhile; ?>` and it works fine - but the [_post_title] mail tag still doesn't work.
Any idea why?
This is ewhat I have:
<?php
if ( have_posts() ) while ( have_posts() ) : the_post();
echo'<h3><a href="' . get_permalink() . '" rel="bookmark">'.get_the_title($post->ID).'</a></h3>' ;
echo the_content();
endwhile;
if( in_category('special-offers') ) : ?>
<p>Apply for this offer by filling out the simple enquiry form below and we will be in touch shortly.</p><!-- this is a html section -->
<?php echo do_shortcode( '[contact-form 3 "Spcial Offers"]' ); ?>
<?php else :
/*php for other*/
endif;
?>
Thanks again!
You placed <?php echo do_shortcode( '[contact-form 3 "Spcial Offers"]' ); ?> after the endwhile ?
Sorry forgot to update!
Worked a treat, thanks!
You must log in to post.