-1, 'offset' => 0, 'orderby' => 'issue_order', 'order' => 'ASC', 'article_format' => empty( $article_format ) ? $aip_magazine_settings['article_format'] : $article_format, 'show_featured' => 1, 'issue' => get_active_aip_magazine_issue($parent), 'article_category' => 'all', 'use_category_order' => 'false', ); // Merge defaults with passed atts // Extract (make each array element its own PHP var extract( shortcode_atts( $defaults, $atts ) ); $args = array( 'posts_per_page' => $posts_per_page, 'offset' => $offset, 'post_type' => 'aip_article', 'orderby' => $orderby, 'order' => $order ); if ( !$show_featured ) { $args['meta_query'] = array( 'relation' => 'AND', array( 'key' => '_featured_rotator', 'compare' => 'NOT EXISTS' ), array( 'key' => '_featured_thumb', 'compare' => 'NOT EXISTS' ) ); } $aip_magazine_issue = array( 'taxonomy' => 'aip_magazine_issue', 'field' => 'slug', 'terms' => $issue ); $args['tax_query'] = array( $aip_magazine_issue ); if ( !empty( $aip_magazine_settings['use_wp_taxonomies'] ) ) $cat_type = 'category'; else $cat_type = 'aip_magazine_issue_categories'; if ('aip_magazine_issue_categories' === $cat_type ) $use_category_order = true; if ( 'true' == $use_category_order && 'aip_magazine_issue_categories' === $cat_type ) { $count = 0; $terms = array(); if ( 'all' === $article_category ) { $all_terms = get_terms( 'aip_magazine_issue_categories'); foreach( $all_terms as $term ) { $issue_cat_meta = get_option( 'aip_magazine_issue_categories_' . $term->term_id . '_meta' ); if ( !empty( $issue_cat_meta['category_order'] ) ) $terms[ $issue_cat_meta['category_order'] ] = $term->slug; } } else { foreach( split( ',', $article_category ) as $term_slug ) { $term = get_term_by( 'slug', $term_slug, 'aip_magazine_issue_categories' ); $issue_cat_meta = get_option( 'aip_magazine_issue_categories_' . $term->term_id . '_meta' ); if ( !empty( $issue_cat_meta['category_order'] ) ) $terms[ $issue_cat_meta['category_order'] ] = $term->slug; else $terms[ '-' . ++$count ] = $term->slug; } } if ($terms!=null) { ksort($terms); } if ( !empty( $terms ) ) { foreach( $terms as $term ) { $category = array( 'taxonomy' => $cat_type, 'field' => 'slug', 'terms' => $term, ); $args['tax_query'] = array( 'relation' => 'AND', $aip_magazine_issue, $category ); $articles = array_merge( $articles, get_posts( $args ) ); } } //And we want all articles not in a category $category = array( 'taxonomy' => $cat_type, 'field' => 'slug', 'terms' => $terms, 'operator' => 'NOT IN', ); $args['tax_query'] = array( 'relation' => 'AND', $aip_magazine_issue, $category ); $articles = array_merge( $articles, get_posts( $args ) ); //Now we need to get rid of duplicates (assuming an article is in more than one category if ( !empty( $articles ) ) { foreach( $articles as $article ) { $post__in[] = $article->ID; } $args['post__in'] = array_unique( $post__in ); $args['orderby'] = 'post__in'; unset( $args['tax_query'] ); $articles = get_posts( $args ); } } else { if ( !empty( $article_category ) && 'all' !== $article_category ) { $category = array( 'taxonomy' => $cat_type, 'field' => 'slug', 'terms' => split( ',', $article_category ), ); $args['tax_query'] = array( 'relation' => 'AND', $aip_magazine_issue, $category ); } $articles = get_posts( $args ); } $results .= '
' . esc_html($issue_array[0]->name) . '
' ; }else{ $results .= '' . $issue_array[0]->name . ' '.$pdf_line.'
' ; } } } if (!$primo_giro) $results .= '' . get_the_term_list( $article->ID, $cat_type ) . '
', $article ); $results .= apply_filters( 'aip_magazine_featured_thumbs_after_thumbnail_category', '', $article ); } $results .= apply_filters( 'aip_magazine_featured_thumbs_before_thumbnail_title', '', $article ); $results .= apply_filters( 'aip_magazine_featured_thumbs_after_thumbnail_title', '' . get_aip_magazine_article_excerpt( $article->ID ) . '
', $article ); break; case 'teaser': default: $results .= apply_filters( 'aip_magazine_featured_thumbs_thumbnail_content', '' . get_post_meta( $article->ID, '_teaser_text', true ) . '
', $article ); break; } $results .= apply_filters( 'aip_magazine_featured_thumbs_after_thumbnail_content', '', $article ); $results .= apply_filters( 'aip_magazine_featured_thumbs_before_thumbnail_byline', '', $article ); if ( isset($aip_magazine_settings['show_thumbnail_byline']) ) { $authors = get_aip_magazine_authors( $article ); if ( !empty( $authors ) ) { $results .= ''; } } $results .= apply_filters( 'aip_magazine_featured_thumbs_before_thumbnail_byline', '', $article ); $results .= apply_filters( 'aip_magazine_featured_thumbs_end_thumbnail_div', '', $article ); $results .= '