1 | <?php |
||
2 | /** |
||
3 | * Three Columns Stories Archive |
||
4 | * |
||
5 | * This template archives comic series pages. |
||
6 | * Show the first image of each comic post on a three columns grid. |
||
7 | * T0DO: excerpts enhancements — Use this template as reference during develoment. |
||
8 | * |
||
9 | * @package WordPress |
||
10 | * @subpackage Strip |
||
11 | */ |
||
12 | |||
13 | get_header(); ?> |
||
14 | |||
15 | <section id="primary" |
||
16 | <div class="content" role="main"> |
||
17 | <div class="wrap"> |
||
18 | <header class="entry-header"> |
||
19 | <h3 class="taxonomy-description"> |
||
20 | <?php printf( '<a href="%s" class="post-parent-title">%s</a>', |
||
21 | esc_url( get_post_type_archive_link( 'comic' ) ), |
||
22 | esc_html( get_the_title() ) |
||
23 | ); ?> |
||
24 | </a></h3> |
||
25 | <h1 class="page-title"><?php the_title(); ?></h1> |
||
26 | </header> |
||
27 | |||
28 | <div class="three-columns"> |
||
29 | |||
30 | <?php |
||
31 | // get the correct paged figure on a Custom Page That Isn’t Static Home Page. |
||
32 | $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; ?> |
||
33 | |||
34 | |||
35 | <?php |
||
36 | |||
37 | // Call and run loop in descending order. |
||
38 | $loop = new WP_Query( array( |
||
39 | 'post_type' => 'comic', |
||
40 | 'story' => '', // add story term here if you want this template to only archive a specific story. |
||
41 | 'posts_per_page' => 12, // changes default Blog pages number "reading settings" set in dashboard. |
||
42 | 'paged' => $paged, // you absolutely need this. |
||
43 | 'orderby' => 'title', // order by title or date. |
||
44 | 'order' => 'ASC', |
||
45 | ) ); |
||
46 | |||
47 | // Start the loop. |
||
48 | if ( $loop->have_posts() ) : |
||
49 | while ( $loop->have_posts() ) : |
||
50 | $loop->the_post(); |
||
51 | ?> |
||
52 | <div class="three-column"> |
||
53 | <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf( esc_html__( 'Permanent Link to %s', 'strip' ),the_title_attribute( 'echo=0' ) ); ?>"></a> |
||
54 | <?php if ( get_the_post_thumbnail() !== '' ) { |
||
55 | |||
56 | echo '<a href="'; |
||
57 | the_permalink(); |
||
58 | echo '" class="thumbnail-wrapper">'; |
||
59 | the_post_thumbnail( 'strip-medium' ); |
||
60 | |||
61 | echo '</a>'; |
||
62 | |||
63 | } else { |
||
64 | |||
65 | echo '<a href="'; |
||
66 | the_permalink(); |
||
67 | echo '" class="thumbnail-wrapper">'; |
||
68 | echo '<img src="'; |
||
69 | echo esc_html( get_first_image( 'strip-medium', 'url' ) ); |
||
0 ignored issues
–
show
|
|||
70 | echo '" alt="" />'; |
||
71 | echo '</a>'; |
||
72 | } ?> |
||
73 | |||
74 | <h2 class="series-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf( esc_html__( 'Permanent Link to %s', 'strip' ), the_title_attribute( 'echo=0' ) ); ?>"><?php the_title(); ?></a></h2> |
||
75 | |||
76 | </div><!-- .column --> |
||
77 | <?php endwhile; ?> |
||
78 | </div><!-- .columns --> |
||
79 | <?php |
||
80 | wp_reset_postdata(); |
||
81 | ?> |
||
82 | |||
83 | <?php |
||
84 | $big = 999999999; // need an unlikely integer. |
||
85 | $translated = __( 'Page', 'strip' ); // supply translatable string. |
||
86 | |||
87 | echo wp_kses_post( paginate_links( // Data validation: wp_kses_post see https://developer.wordpress.org/reference/functions/wp_kses_post/. |
||
88 | array( |
||
89 | 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
||
90 | 'format' => '?paged=%#%', |
||
91 | 'current' => max( 1, get_query_var( 'paged', 1 ) ), |
||
92 | 'total' => $loop->max_num_pages, |
||
93 | 'before_page_number' => '<span class="screen-reader-text">' . $translated . ' </span>', |
||
94 | 'prev_text' => esc_html__( 'Previous', 'strip' ), // If you want to change the previous link text. |
||
95 | 'next_text' => esc_html__( 'Next', 'strip' ), // If you want to change the next link text. |
||
96 | 'type' => 'title', // How you want the return value to be formatted. |
||
97 | 'add_fragment' => '#result', // Your anchor. |
||
98 | ) ) ); |
||
99 | |||
100 | else : |
||
101 | get_template_part( 'no-results', 'archive-comic' ); |
||
102 | endif; ?> |
||
103 | |||
104 | </div><!-- .wrap --> |
||
105 | </main><!-- #content --> |
||
106 | </section><!-- #primary --> |
||
107 | |||
108 | <?php get_sidebar(); ?> |
||
109 | <?php get_footer(); ?> |
||
110 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.