PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

hooking to the_content AND gform_after_submission?

  1. 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

    Posted 11 years ago on Monday April 15, 2013 | Permalink
  2. Can anyone help with this?? I'm really stuck and am so close to achieving what I need!

    Posted 11 years ago on Tuesday April 16, 2013 | Permalink
  3. ANYONE!? Please!

    The function above does EXACTLY what I need EXCEPT that I need the wp_query loop to display within the post_content, not immediately after <body>..

    My work so far is bodged together from this example function:
    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Please help!!

    Posted 11 years ago on Tuesday April 16, 2013 | Permalink