Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter devtat

    (@devtat)

    Adding session_start() inside the alm_query_args function seems to have finally fixed it.

    Would have been nice to be able to pass the whole $wp_query->get('tax_query') value without having to re-create it though.

    Thread Starter devtat

    (@devtat)

    Code is something like this in functions.php:

    
    function theme_folio_listing($args, $id){
    $args['post_type'] = 'folio';
    $tax_query = array( 'relation' => 'AND' );
    
    if( isset($_SESSION['source']) ){
     $args['meta_query'] = array(array( 'key'=>'author', 'value' => $_SESSION['source'], 'compare' => '=' ));
    }
    if( isset($_SESSION['format']) ){
      $tax_query[] = array( 'taxonomy' => 'folio_format', 'field' => 'id', 'terms' => $_SESSION['format'] , 'operator' => 'IN' );
    } else {
      $tax_query[] = array( 'taxonomy' => 'folio_format', 'field' => 'id', 'operator' => 'EXISTS' );
    }
    if( isset($_SESSION['tags']) ){
      $tax_query[] = array( 'taxonomy' => 'folio_tags', 'field' => 'id', 'terms' => $_SESSION['tags'], 'operator' => 'IN' );
    }
    $args['tax_query'] = $tax_query;
    
    return $args;
    }
    add_filter( 'alm_query_args_folio_listing', 'theme_folio_listing', 10, 2);
    add_filter( 'alm_debug', '__return_true' );
    

    Then, on the archive page:

    
    do_shortcode('[ajax_load_more id="folio_listing" css_classes="section" container_type="section" offset="" posts_per_page="10" pause="false" transition_container_classes="folio-grid"]');
    

    ALM Debug shows me that that my $_POST/$_SESSION fail to be read and fallback to ‘else’, so how can I pass variable data to ‘alm_query_args’ – is it possible? Query variables would need to change each time page is accessed/refreshed.

    Thread Starter devtat

    (@devtat)

    Thanks! 🙂

    I ended up having to hook into both 'acf/save_post' and 'acf/pending_post', and switch to a normal select dropdown to cover the many different actions I wanted there.

Viewing 3 replies - 1 through 3 (of 3 total)