Support

Account

Home Forums ACF PRO Using ACF Pro to create Posts Grid Reply To: Using ACF Pro to create Posts Grid

  • That white screen means there is probably a syntax error in your code. When working on PHP code you should enable wp debugging https://codex.wordpress.org/WP_DEBUG

    Also I notices that there is an error in what I posted

    
    <?php
    
    $categories = get_field('my_category_field');
    // make sure it is an array, if only one is
    // selected it may return a single value
    if (!is_array($categories)) {
      $categories = array($categories);
    }
    $tags = get_field('my_tags_field');
    if (!is_array($tags)) {
      $tags = array($tags);
    }
    $args = array(
      'post_type' => 'post',
      'posts_per_page' => -1,
      'tax_query' => array(
        'relation' => 'OR',
        array(
          'taxonomy' => 'category',
          'terms' => $categories
        ),
        array(
          'taxonomy' => 'post_tag',
          'terms' => $tags
        )
      )
    );
    $query = new WP_Query($args);
    
    // loop reuslts here to display posts
    
    ?>