• Here’s my issue.
    I have a form that has three drop downs.
    https://fifteenforty.wpengine.com/learn-page-search/

    Cancer Type, Age & Diagnosis and Lessons Learned. These are a custom taxonomy for a custom post type called story.

    A visitor can pick from 1 or 2 or 3 dropdowns.
    I know how to do the query and that’s working fine. I just am trying to figure out how to built the $args dynamically based upon what is chosen when the form is submitted.

    If they just choose from the Cancer Type, then $args would be
    ‘ $args=array(
    ‘post_type’ => ‘story’,
    ‘cancer-type’ => $cancer_type,
    ‘orderby’ => ‘date’,
    ‘order’ => ‘DESC’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1,
    ); ‘

    If they choose both Cancer Type & Age, $args would be

    ‘ $args=array(
    ‘post_type’ => ‘story’,
    ‘cancer-type’ => $cancer_type,
    ‘age-diagnosis-range’ => $age,
    ‘orderby’ => ‘date’,
    ‘order’ => ‘DESC’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1,
    );

    How do I take the POST and write the $args dynamically? Or am I totally missing the boat here.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Build the args parameter dynamically when don't how/which args’ is closed to new replies.