Skip to content

Commit bd24946

Browse files
Ignore pagination option
1 parent 1134737 commit bd24946

File tree

4 files changed

+168
-149
lines changed

4 files changed

+168
-149
lines changed

addons/auto-pagination/auto-pagination-functions.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,25 @@ public function pagination_metabox_render($post) {
9898
<option value="ignore" <?php if ($value == "ignore") echo "SELECTED"; ?>><?php _e("Ignore inline &lt;!--nextpage--&gt; tags.", SH_PAGE_LINKS_DOMAIN); ?></option>
9999
<option value="noignore" <?php if ($value == "noignore") echo "SELECTED"; ?>><?php _e("Accomodate inline &lt;!--nextpage--&gt; tags.", SH_PAGE_LINKS_DOMAIN); ?></option>
100100
</select>
101+
<br /><br />
102+
<?php
103+
$value = get_post_meta($post->ID,"single_not_paginate",true);
104+
$postType = get_post_type_object(get_post_type($post));
105+
$ptype = '';
106+
if ($postType)
107+
$ptype = $postType->labels->singular_name;
108+
?>
109+
<input type="checkbox" id="single_not_paginate" name="single_not_paginate" value="yes" <?php checked( 'yes', $value, true ); ?> /><label for="single_not_paginate"><?php _e("Don't paginate this", SH_PAGE_LINKS_DOMAIN); echo ' ' . strtolower($ptype); ?></label>
101110
<?php
102111
}
103112

104113
public function pagination_metabox_render_save($post_id) {
105-
global $post;
106114

107115
if ( ! isset( $_POST['pagination_override'] ) || ! wp_verify_nonce( $_POST['pagination_override'], plugin_basename( __FILE__ ) ) )
108116
return;
109117

110-
update_post_meta($post->ID, 'single_override_pagination', $_POST['single_override_pagination']);
118+
update_post_meta($post_id, 'single_override_pagination', $_POST['single_override_pagination']);
119+
update_post_meta($post_id, 'single_not_paginate', $_POST['single_not_paginate']);
111120
}
112121

113122

@@ -150,6 +159,11 @@ public function generate_excerpt($text) {
150159
*/
151160
public function add_pagination($content) {
152161
global $sh_page_links, $auto_paged, $post, $sh_single_view, $pages_count;
162+
163+
//Check if is set to ignore pagination
164+
if (get_post_meta( $post->ID, 'single_not_paginate', true ) == 'yes')
165+
return $content;
166+
153167
$options = $sh_page_links->get_options();
154168

155169
$content = str_replace("<!--nextpage-->", "", $content);
@@ -310,23 +324,23 @@ public function get_pages($content, $options = false) {
310324
if ($break_on < 1)
311325
$break_on == 1;
312326
$excess = $paragraph_count%$page_count;
313-
$modified_exploded_content = $array;
327+
$modified_exploded_content = array();
314328
foreach ($content_pages as $page) {
315329
$i++;
316330
if ($i > $break_on) {
317331
if ($excess > 0) {
318332
$excess--;
319-
$modified_exploded_content[$j] .= $page . "\n<!--sh_nextpage-->";
333+
$modified_exploded_content[$j] = $page . "\n<!--sh_nextpage-->";
320334
$j++;
321335
$i = 0;
322336
continue;
323337
} else {
324-
$modified_exploded_content[$j] .= "\n<!--sh_nextpage-->";
338+
$modified_exploded_content[$j] = "\n<!--sh_nextpage-->";
325339
}
326340
$i = 1;
327341
$j++;
328342
}
329-
$modified_exploded_content[$j] .= $page;
343+
$modified_exploded_content[$j] = $page;
330344
}
331345

332346
} elseif ($options['break_type'] == 2) {

addons/scrolling-pagination/scrolling-pagination-functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function generate_scrolling_pagination($content, $page, $pages, $args, $s
110110
if (!empty($args)) {
111111
$link_wrapper = $args['link_wrapper'];
112112
$link_class = "";
113-
$link_classes[0] = $current_class;
113+
$link_classes[0] = '';
114114
$link_classes[1] = $args['link_wrapper_class'];
115115
$link_class = " class=\"" . trim(implode(" ", $link_classes)) . "\"";
116116
if ($link_wrapper) {

0 commit comments

Comments
 (0)