Hi guys
I've got an issue that I can't get my head around..
I'm using the following function to return a loop of custom posts upon submission of form ID 18:
add_action("gform_after_submission_18", "set_post_content", 10, 2);
function set_post_content($entry, $form){
//getting post
$post = get_post($entry["post_id"]);
$concern = $entry[13];
$sensitivity = $entry[18];
$loop = new WP_Query( array(
'post_type' => 'recommended',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'concern',
'field' => 'slug',
'terms' => $concern
),
array(
'taxonomy' => 'sensitivity',
'field' => 'slug',
'terms' => $sensitivity
)
),
'orderby' => 'title',
'posts_per_page' => '-1',
'order' => 'ASC'
)
); ?>
<ul><?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li><?php the_title(); ?></li>
<?php endwhile; ?></ul>
<php
}
This wp_query loop returns only the posts that have been given terms to the taxomonies "concern" and "sensitivity" that match those chosen by the user from form fields (radio buttons) with IDs 13 and 18..
The issue is that the loop displays immediately after <body> rather than in the post body.
I would usually use the hook the_content to put hook into the right place but I can't see how to do this as I'm already using the GF hook : gform_after_submission_18
Can anyone help? I've been on this most of the day today and I'm not sure if I'm going about it all wrong!?
Thanks
Martin