Code Duplication    Length = 31-31 lines in 4 locations

modules/infinite-scroll/themes/twentyfifteen.php 1 location

@@ 75-105 (lines=31) @@
72
 *
73
 * @return string
74
 */
75
function twentyfifteen_amp_infinite_output( $buffer ) {
76
	// Hide site header on next page load.
77
	$buffer = preg_replace(
78
		'/<header id="masthead"/',
79
		'$0 next-page-hide',
80
		$buffer
81
	);
82
83
	// Hide skip link.
84
	$buffer = preg_replace(
85
		'/<a class="skip-link screen-reader-text"/',
86
		'$0 next-page-hide hidden',
87
		$buffer
88
	);
89
90
	// Hide below nav bar.
91
	$buffer = preg_replace(
92
		'/<nav class="navigation pagination"/',
93
		'$0 next-page-hide hidden',
94
		$buffer
95
	);
96
97
	// Remove the footer as it will be added back to amp next page footer.
98
	$buffer = preg_replace(
99
		'/<footer id="colophon".*<!-- .site-footer -->/s',
100
		'',
101
		$buffer
102
	);
103
104
	return $buffer;
105
}
106
107
/**
108
 * Filter the AMP infinite scroll older posts button

modules/infinite-scroll/themes/twentyfourteen.php 1 location

@@ 103-133 (lines=31) @@
100
 *
101
 * @return string
102
 */
103
function twentyfourteen_amp_infinite_output( $buffer ) {
104
	// Hide site header on next page load.
105
	$buffer = preg_replace(
106
		'/<header id="masthead"/',
107
		'$0 next-page-hide',
108
		$buffer
109
	);
110
111
	// Remove the sidebar as it will be added back to amp next page footer.
112
	$buffer = preg_replace(
113
		'/<div id="secondary".*<!-- #secondary -->/s',
114
		'',
115
		$buffer
116
	);
117
118
	// Hide below nav bar.
119
	$buffer = preg_replace(
120
		'/<nav class="navigation paging-navigation"/',
121
		'$0 next-page-hide hidden',
122
		$buffer
123
	);
124
125
	// Remove the footer as it will be added back to amp next page footer.
126
	$buffer = preg_replace(
127
		'/<footer id="colophon".*<!-- #colophon -->/s',
128
		'',
129
		$buffer
130
	);
131
132
	return $buffer;
133
}
134
135
/**
136
 * Filter the AMP infinite scroll older posts button

modules/infinite-scroll/themes/twentytwelve.php 1 location

@@ 98-128 (lines=31) @@
95
 *
96
 * @return string
97
 */
98
function twentytwelve_amp_infinite_output( $buffer ) {
99
	// Hide site header on next page load.
100
	$buffer = preg_replace(
101
		'/<header id="masthead"/',
102
		'$0 next-page-hide',
103
		$buffer
104
	);
105
106
	// Hide below nav bar.
107
	$buffer = preg_replace(
108
		'/<nav id="nav-below"/',
109
		'$0 next-page-hide hidden',
110
		$buffer
111
	);
112
113
	// Remove the sidebar as it will be added back to amp next page footer.
114
	$buffer = preg_replace(
115
		'/<div id="secondary".*<!-- #secondary -->/s',
116
		'',
117
		$buffer
118
	);
119
120
	// Remove the footer as it will be added back to amp next page footer.
121
	$buffer = preg_replace(
122
		'/<footer id="colophon".*<!-- #colophon -->/s',
123
		'',
124
		$buffer
125
	);
126
127
	return $buffer;
128
}
129
130
/**
131
 * Filter the AMP infinite scroll older posts button

modules/theme-tools/compat/twentytwenty.php 1 location

@@ 211-241 (lines=31) @@
208
 *
209
 * @return string
210
 */
211
function twentytwenty_amp_infinite_output( $buffer ) {
212
	// Hide site header on next page load.
213
	$buffer = preg_replace(
214
		'/id="site-header"/',
215
		'$0 next-page-hide',
216
		$buffer
217
	);
218
219
	// Hide pagination on next page load.
220
	$buffer = preg_replace(
221
		'/class=".*pagination-wrapper.*"/',
222
		'$0 next-page-hide hidden',
223
		$buffer
224
	);
225
226
	// Remove the footer as it will be added back to amp next page footer.
227
	$buffer = preg_replace(
228
		'/<div class="footer-nav-widgets-wrapper.*<!-- .footer-nav-widgets-wrapper -->/s',
229
		'',
230
		$buffer
231
	);
232
233
	// Remove the footer as it will be added back to amp next page footer.
234
	$buffer = preg_replace(
235
		'/<footer id="site-footer".*<!-- #site-footer -->/s',
236
		'',
237
		$buffer
238
	);
239
240
	return $buffer;
241
}
242
243
/**
244
 * Filter the AMP infinite scroll separator