|
29 | 29 | foreach ( $main_doc['sections'] as $section ) { |
30 | 30 | $article_args = array( |
31 | 31 | 'post_type' => 'docs', |
32 | | - 'posts_per_page' => ! empty( $article_limit ) && $article_limit > 0 ? $article_limit : '-1', |
| 32 | + 'posts_per_page' => $article_limit > 0 ? $article_limit + 1 : '-1', |
33 | 33 | 'orderby' => 'menu_order', |
34 | | - 'order' => 'ASC' |
| 34 | + 'order' => 'ASC', |
35 | 35 | ); |
36 | 36 |
|
37 | 37 | $article_args = apply_filters( 'wedocs_shortcode_page_section_args', $article_args ); |
|
40 | 40 |
|
41 | 41 | $article_args = apply_filters( 'wedocs_shortcode_page_article_args', $article_args, $section ); |
42 | 42 |
|
43 | | - $children_docs = get_children( $article_args ); |
44 | | - $total_children = count( $children_docs ); |
45 | | - $has_more_articles = ! empty( $article_limit ) && $article_limit > 0 && $total_children > $article_limit; |
| 43 | + $article_query = new \WP_Query( $article_args ); |
| 44 | + $children_docs = $article_query->posts; |
| 45 | + $has_more_articles = $article_limit > 0 && count( $children_docs ) > $article_limit; |
46 | 46 | if ( $has_more_articles ) { |
47 | 47 | $children_docs = array_slice( $children_docs, 0, $article_limit ); |
48 | 48 | } |
|
54 | 54 | $collapse_section_articles = wedocs_get_general_settings( 'collapse_articles', 'off' ); |
55 | 55 | ?> |
56 | 56 | <li> |
57 | | - <a class='icon-view' href="<?php echo get_permalink( $section->ID ); ?>" target='_blank'> |
| 57 | + <a class='icon-view' href="<?php echo get_permalink( $section->ID ); ?>" target='_blank' rel='noopener noreferrer'> |
58 | 58 | <?php echo esc_html( $post_title ); ?> |
59 | 59 | </a> |
60 | 60 | <?php if ( $children_docs ) : ?> |
@@ -82,7 +82,7 @@ class='children has-icon <?php echo esc_attr( $collapse_section_articles !== 'on |
82 | 82 | <?php endforeach; ?> |
83 | 83 | <?php if ( $has_more_articles ) : ?> |
84 | 84 | <li class="wedocs-view-all"> |
85 | | - <a href="<?php echo get_permalink( $section->ID ); ?>" target='_blank'> |
| 85 | + <a href="<?php echo get_permalink( $section->ID ); ?>" target='_blank' rel='noopener noreferrer'> |
86 | 86 | <?php esc_html_e( 'View all', 'wedocs' ); ?> |
87 | 87 | </a> |
88 | 88 | </li> |
|
0 commit comments