Content Views – Post Grid & List for WordPress - Version 2.0

Version Description

  • 2018/04/03 =
  • Update: Friendly URL for normal pagination, redirect /?vpage=PAGENUM to /page/PAGENUM
  • Compatible Fix: Excerpt of posts created by the Cornerstone Page Builder plugin is incorrect
  • Tweak: Update content of the Settings page and description of some settings
Download this release

Release Info

Developer PT Guy
Plugin Icon 128x128 Content Views – Post Grid & List for WordPress
Version 2.0
Comparing to
See all releases

Code changes from version 1.9.9.6 to 2.0

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: pt-guy
3
  Donate link: https://www.contentviewspro.com/?utm_source=wporg&utm_medium=link&utm_campaign=donate
4
  Tags: post grid, grid plugin, grid, latest post, display post, post, page, category, responsive, list, thumbnail
5
  Requires at least: 3.3
6
- Tested up to: 4.9.2
7
- Stable tag: 1.9.9.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -163,6 +163,11 @@ If you are using "Your latest posts" as home page, you should paste this code `<
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
166
  = 1.9.9.6 - 2018/01/19 =
167
  * Fix: Embedded URLs (that are on their own line) in post content shows in the excerpt
168
  * Update: Remove dependence of "Show Thumbnail" to "Format" setting, of "Show Taxonomies" to "Content Type" setting
3
  Donate link: https://www.contentviewspro.com/?utm_source=wporg&utm_medium=link&utm_campaign=donate
4
  Tags: post grid, grid plugin, grid, latest post, display post, post, page, category, responsive, list, thumbnail
5
  Requires at least: 3.3
6
+ Tested up to: 4.9.5
7
+ Stable tag: 2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
163
 
164
  == Changelog ==
165
 
166
+ = 2.0 - 2018/04/03 =
167
+ * Update: Friendly URL for normal pagination, redirect /?vpage=PAGENUM to /page/PAGENUM
168
+ * Compatible Fix: Excerpt of posts created by the Cornerstone Page Builder plugin is incorrect
169
+ * Tweak: Update content of the Settings page and description of some settings
170
+
171
  = 1.9.9.6 - 2018/01/19 =
172
  * Fix: Embedded URLs (that are on their own line) in post content shows in the excerpt
173
  * Update: Remove dependence of "Show Thumbnail" to "Format" setting, of "Show Taxonomies" to "Content Type" setting
admin/includes/templates/settings-section-one.php CHANGED
@@ -1 +1 @@
1
- <p><br>Thank you for using Content Views (version <code><?php echo esc_html( PT_CV_Functions::plugin_info( PT_CV_FILE, 'Version' ) ); ?></code>).</p>
1
+ <p style="margin-top:10px">Thank you for using Content Views (version <code><?php echo esc_html( PT_CV_Functions::plugin_info( PT_CV_FILE, 'Version' ) ); ?></code>).</p>
admin/includes/templates/settings-section-two.php CHANGED
@@ -10,18 +10,21 @@
10
 
11
  .cvgopro {
12
  color: #fe1243;
13
- font-size: 2em;
14
  margin-bottom: 20px;
15
  }
16
 
 
 
17
  h3 {
18
- font-size: 1.2em!important;
19
- margin: 0 0 10px!important;
20
  color: #111!important;
 
21
  }
22
 
23
  #pt-cv-features > div {
24
- margin-bottom: 20px;
25
  }
26
 
27
  #pt-cv-features ul {
@@ -41,42 +44,40 @@
41
  $cp = '?utm_source=client&utm_medium=settings_page&utm_campaign=gopro';
42
  ?>
43
 
44
- <h3>&raquo; <a style="font-size: 18px;" href="http://docs.contentviewspro.com/<?php echo $cp; ?>" target="_blank">Documentation</a></h3>
45
 
46
  <hr>
47
 
48
- <h2 class="cvgopro">More benefits and value for your site:</h2>
49
 
50
  <div class="row" id="pt-cv-features">
51
  <div class="col-md-12">
52
- <h3>Filter Any Post Type, Custom Field, Taxonomy</h3>
53
  <div>
54
  <ul>
55
- <li>support custom post type: WooCommerce, Easy Digital Downloads, Events... (<a href="http://sample.contentviewspro.com/supports/woocommerce-3/<?php echo $cp; ?>" target="_blank">view sample</a>)</li>
56
- <li>support custom field: Advanced Custom Fields, Pods, Types... (<a href="http://sample.contentviewspro.com/supports/advanced-custom-fields/<?php echo $cp; ?>" target="_blank">view sample</a>)</li>
57
- <li>support custom taxonomy</li>
58
  </ul>
59
  </div>
60
  </div>
61
  <div class="col-md-12">
62
- <h3>More Amazing Layouts</h3>
63
  <div>
64
- Pinterest, Masonry, Timeline, One & others, Glossary, Overlay... (<a href="http://sample.contentviewspro.com/view-type/pinterest/<?php echo $cp; ?>" target="_blank">view sample</a>)
65
  </div>
66
  </div>
67
  <div class="col-md-12">
68
  <h3>Grid Layout For Blog, Category, Search... Page</h3>
69
- <div>Use beautiful grid for Blog, Category, Tag, Search results... page in seconds, without coding (<a href="http://docs.contentviewspro.com/completely-replace-wordpress-layout-by-content-views-pro-layout/<?php echo $cp; ?>" target="_blank">view demo</a>)</div>
 
 
 
 
70
  </div>
71
  <div class="col-md-12">
72
  <h3>Make Money Online $</h3>
73
- <div>Make money from your website, by displaying your Google Adsense, affiliate banners... between posts in grid, list easily (<a href="https://www.contentviewspro.com/<?php echo $cp; ?>#show-ads" target="_blank">read more</a>)</div>
74
  </div>
75
  </div>
76
 
77
- <div style="clear:both"></div>
78
- <a href="https://www.contentviewspro.com/<?php echo $cp; ?>" target="_blank" class="btn btn-success">Learn more about Pro version</a>
79
-
80
- <p><br><a href="https://www.contentviewspro.com/contact/<?php echo $cp; ?>" target="_blank">Report bugs, ask questions? Contact Us Now.</a></p>
81
-
82
- <hr>
10
 
11
  .cvgopro {
12
  color: #fe1243;
13
+ font-size: 23px;
14
  margin-bottom: 20px;
15
  }
16
 
17
+ hr {margin: 0 0 !important;}
18
+
19
  h3 {
20
+ font-size: 18px!important;
21
+ margin: 0 0 8px!important;
22
  color: #111!important;
23
+ font-weight: 600!important;
24
  }
25
 
26
  #pt-cv-features > div {
27
+ margin-bottom: 15px;
28
  }
29
 
30
  #pt-cv-features ul {
44
  $cp = '?utm_source=client&utm_medium=settings_page&utm_campaign=gopro';
45
  ?>
46
 
47
+ <p><a href="//docs.contentviewspro.com/<?php echo $cp; ?>" target="_blank">Documentation</a> | <a href="//www.contentviewspro.com/contact/<?php echo $cp; ?>" target="_blank">Contact Us</a></p>
48
 
49
  <hr>
50
 
51
+ <h2 class="cvgopro">More benefits and values for your site:</h2>
52
 
53
  <div class="row" id="pt-cv-features">
54
  <div class="col-md-12">
55
+ <h3>Filter Custom Post Type, Custom Field, Custom Taxonomy</h3>
56
  <div>
57
  <ul>
58
+ <li>support custom post type: WooCommerce, Easy Digital Downloads, Events... (<a href="//sample.contentviewspro.com/supports/woocommerce-3/<?php echo $cp; ?>" target="_blank">view sample</a>)</li>
59
+ <li>support custom field: Advanced Custom Fields, Pods, Types... (<a href="//sample.contentviewspro.com/supports/advanced-custom-fields/<?php echo $cp; ?>" target="_blank">view sample</a>)</li>
 
60
  </ul>
61
  </div>
62
  </div>
63
  <div class="col-md-12">
64
+ <h3>More Amazing Layouts To Attract Your Visitors</h3>
65
  <div>
66
+ Pinterest, Masonry, Timeline, One & others, Glossary, Overlay... (<a href="//sample.contentviewspro.com/view-type/pinterest/<?php echo $cp; ?>" target="_blank">view sample</a>)
67
  </div>
68
  </div>
69
  <div class="col-md-12">
70
  <h3>Grid Layout For Blog, Category, Search... Page</h3>
71
+ <div>Use the beautiful grid for Blog, Category, Tag, Search results... page easily without coding (<a href="//docs.contentviewspro.com/completely-replace-wordpress-layout-by-content-views-pro-layout/<?php echo $cp; ?>" target="_blank">read more</a>)</div>
72
+ </div>
73
+ <div class="col-md-12">
74
+ <h3>Design Without Writing CSS</h3>
75
+ <div>Easy to customize the style of text, button with unlimited color, hundreds of font families, font-size... (<a href="//docs.contentviewspro.com/style-settings/<?php echo $cp; ?>" target="_blank">read more</a>)</div>
76
  </div>
77
  <div class="col-md-12">
78
  <h3>Make Money Online $</h3>
79
+ <div>Display Google Adsense, affiliate banners... between the posts grid easily (<a href="//www.contentviewspro.com/<?php echo $cp; ?>#show-ads" target="_blank">read more</a>)</div>
80
  </div>
81
  </div>
82
 
83
+ <p><a href="//www.contentviewspro.com/<?php echo $cp; ?>" target="_blank" class="btn btn-primary">Get Pro Now</a></p>
 
 
 
 
 
admin/views/view.php CHANGED
@@ -310,7 +310,7 @@ PT_CV_Functions::view_submit();
310
  ),
311
  ),
312
  // Upgrade to Pro: Custom taxonomy
313
- !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter by custom taxonomies', 'content-views-query-and-display-post-page' ) ) : '',
314
  // Terms list
315
  array(
316
  'label' => array(
@@ -348,7 +348,7 @@ PT_CV_Functions::view_submit();
348
  ),
349
  ),
350
  ),
351
- !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( sprintf( __( 'In this lite version, when you select any term above, it will not replace posts layout in term page (for example: %s) with layout of this View', 'content-views-query-and-display-post-page' ), '<code style="font-size: 11px;">http://yourdomain/category/selected_term/</code>' ), 12, null, true ) : '',
352
  apply_filters( PT_CV_PREFIX_ . 'taxonomies_custom_settings', array() ),
353
  ), // End Taxonomies Settings
354
  // Sort by Settings
310
  ),
311
  ),
312
  // Upgrade to Pro: Custom taxonomy
313
+ !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter by custom taxonomy', 'content-views-query-and-display-post-page' ) ) : '',
314
  // Terms list
315
  array(
316
  'label' => array(
348
  ),
349
  ),
350
  ),
351
+ !get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'In this lite version, it is not possible to replace posts layout in category/tag page with the layout of this View.<br>In the Pro version, it is possible', 'content-views-query-and-display-post-page' ), 12, null, true ) : '',
352
  apply_filters( PT_CV_PREFIX_ . 'taxonomies_custom_settings', array() ),
353
  ), // End Taxonomies Settings
354
  // Sort by Settings
content-views.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
- * Version: 1.9.9.6
14
  * Author: CVSOFT LLC
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views-query-and-display-post-page
@@ -25,7 +25,7 @@ if ( !defined( 'ABSPATH' ) ) {
25
  }
26
 
27
  // Define Constant
28
- define( 'PT_CV_VERSION', '1.9.9.6' );
29
  define( 'PT_CV_FILE', __FILE__ );
30
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
31
  include_once( PT_CV_PATH . 'includes/defines.php' );
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
+ * Version: 2.0
14
  * Author: CVSOFT LLC
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views-query-and-display-post-page
25
  }
26
 
27
  // Define Constant
28
+ define( 'PT_CV_VERSION', '2.0' );
29
  define( 'PT_CV_FILE', __FILE__ );
30
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
31
  include_once( PT_CV_PATH . 'includes/defines.php' );
includes/compatibility.php CHANGED
@@ -73,6 +73,55 @@ function cv_comp_plugin_siteoriginbuilder( $args, $fargs, $this_post ) {
73
  return $args;
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  /**
77
  * FacetWP
78
  * Missing posts in output when access page with parameters 'fwp_*' of FacetWP plugin
@@ -218,6 +267,14 @@ function cv_comp_pagination_settings( $action, $view_settings ) {
218
 
219
  if ( !empty( $key ) && !empty( $case ) ) {
220
  $cv_unique_id = $key;
 
 
 
 
 
 
 
 
221
  set_transient( PT_CV_PREFIX . 'view-settings-' . $cv_unique_id, $view_settings, 30 * MINUTE_IN_SECONDS );
222
  }
223
  } else if ( $action === 'get' ) {
@@ -247,3 +304,37 @@ function cv_comp_common_slider_number_in_excerpt( $args ) {
247
  $args = preg_replace( '/<li[^>]*>(\d+)<\/li>/', '', $args );
248
  return $args;
249
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  return $args;
74
  }
75
 
76
+ /**
77
+ * Cornerstone Page Builder
78
+ * Excerpt/thumbnal is incorrect (can't get)
79
+ * @since 2.0
80
+ */
81
+ add_filter( 'the_content', 'cv_comp_plugin_cornerstone_single', PHP_INT_MAX );
82
+ function cv_comp_plugin_cornerstone_single( $content ) {
83
+ if ( isset( $_REQUEST[ 'cv_comp_cs_content' ] ) ) {
84
+ // Save the content, which is already processed by Cornerstone
85
+ update_post_meta( get_the_ID(), 'cv_comp_cornerstone_content', array(
86
+ 'expires' => time() + DAY_IN_SECONDS,
87
+ 'data' => $content,
88
+ ) );
89
+ }
90
+
91
+ return $content;
92
+ }
93
+
94
+ add_filter( 'pt_cv_field_content_excerpt', 'cv_comp_plugin_cornerstone_core', 9, 3 );
95
+ add_filter( 'pt_cv_field_content_full', 'cv_comp_plugin_cornerstone_core', 9, 3 );
96
+ function cv_comp_plugin_cornerstone_core( $args, $fargs, $this_post ) {
97
+ if ( cv_is_active_plugin( 'cornerstone' ) ) {
98
+ $cache = $this_post->cv_comp_cornerstone_content;
99
+ if ( empty( $cache ) || $cache[ 'expires' ] < time() ) {
100
+ // Simulate the frontend, to get processed output by Cornerstone
101
+ file_get_contents( add_query_arg( 'cv_comp_cs_content', 1, get_permalink( $this_post->ID ) ) );
102
+ // Get the processed content
103
+ $cache = get_post_meta( $this_post->ID, 'cv_comp_cornerstone_content', true );
104
+ }
105
+
106
+ if ( isset( $cache[ 'data' ] ) ) {
107
+ $args = $cache[ 'data' ];
108
+ }
109
+ }
110
+
111
+ return $args;
112
+ }
113
+
114
+ // Prevent error "The preview was unresponsive after loading"
115
+ add_action( 'cornerstone_load_builder', 'cv_comp_plugin_cornerstone_builder' );
116
+ add_action( 'cornerstone_before_boot_app', 'cv_comp_plugin_cornerstone_builder' );
117
+ add_action( 'cornerstone_before_ajax', 'cv_comp_plugin_cornerstone_builder' );
118
+ add_action( 'cornerstone_before_load_preview', 'cv_comp_plugin_cornerstone_builder' );
119
+ function cv_comp_plugin_cornerstone_builder() {
120
+ if ( defined( 'PT_CV_POST_TYPE' ) ) {
121
+ remove_shortcode( PT_CV_POST_TYPE );
122
+ }
123
+ }
124
+
125
  /**
126
  * FacetWP
127
  * Missing posts in output when access page with parameters 'fwp_*' of FacetWP plugin
267
 
268
  if ( !empty( $key ) && !empty( $case ) ) {
269
  $cv_unique_id = $key;
270
+
271
+ // Simplify the array
272
+ foreach ( $view_settings as $key => $value ) {
273
+ if ( strpos( $key, PT_CV_PREFIX . 'font-' ) === 0 ) {
274
+ unset( $view_settings[ $key ] );
275
+ }
276
+ }
277
+
278
  set_transient( PT_CV_PREFIX . 'view-settings-' . $cv_unique_id, $view_settings, 30 * MINUTE_IN_SECONDS );
279
  }
280
  } else if ( $action === 'get' ) {
304
  $args = preg_replace( '/<li[^>]*>(\d+)<\/li>/', '', $args );
305
  return $args;
306
  }
307
+
308
+ /** Fix error "View * may not exist" caused by the "Shortcodes Anywhere or Everywhere" plugin
309
+ * @since 2.0
310
+ */
311
+ add_action( 'pt_cv_get_view_settings', 'cv_comp_plugin_saoe' );
312
+ function cv_comp_plugin_saoe() {
313
+ remove_filter( 'get_post_metadata', 'jr_saoe_get_post_metadata', 10 );
314
+ }
315
+
316
+ /** Redirect old /?vpage= to /?paged=
317
+ * @since 2.0
318
+ */
319
+ add_action( 'init', 'cv_comp_common_redirect_vpage', 1 );
320
+ function cv_comp_common_redirect_vpage() {
321
+ if ( !empty( $_GET[ 'vpage' ] ) && !headers_sent() ) {
322
+ $pagenum = absint( $_GET[ 'vpage' ] );
323
+ if ( $pagenum >= 1 ) {
324
+ $new_url = remove_query_arg( 'vpage', get_pagenum_link( $pagenum, false ) );
325
+ wp_safe_redirect( $new_url, 301 );
326
+ exit;
327
+ }
328
+ }
329
+ }
330
+
331
+ /** Compatible with Timeline layout which uses 'vpage'
332
+ * @since 2.0
333
+ */
334
+ add_action( PT_CV_PREFIX_ . 'view_process_start', 'cv_comp_pro_timeline' );
335
+ function cv_comp_pro_timeline() {
336
+ $pagenum = get_query_var( 'paged' );
337
+ if ( !empty( $pagenum ) ) {
338
+ $_GET[ 'vpage' ] = 'notempty'; /* not empty value is enough for compatibility */
339
+ }
340
+ }
includes/functions.php CHANGED
@@ -606,6 +606,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
606
  return;
607
  }
608
 
 
 
609
  $view_settings = array();
610
 
611
  $post_id = PT_CV_Functions::post_id_from_meta_id( $meta_id );
@@ -1252,7 +1254,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1252
  $data_page = sprintf( 'data-page="%s"', absint( $this_page ) );
1253
  }
1254
 
1255
- $html = sprintf( '<a %s href="%s">%s</a>', $data_page, esc_url( add_query_arg( 'vpage', $this_page ) ), $label );
1256
  $class = $class ? sprintf( 'class="%s"', esc_attr( $class ) ) : '';
1257
 
1258
  return sprintf( '<li %s>%s</li>', $class, $html );
@@ -1331,9 +1333,9 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1331
  if ( !empty( $pargs[ 'page' ] ) ) {
1332
  $paged = absint( $pargs[ 'page' ] );
1333
  }
1334
-
1335
- if ( !empty( $_GET[ 'vpage' ] ) && PT_CV_Functions::setting_value( PT_CV_PREFIX . 'pagination-type' ) === 'normal' ) {
1336
- $paged = absint( $_GET[ 'vpage' ] );
1337
  }
1338
  }
1339
 
606
  return;
607
  }
608
 
609
+ do_action( PT_CV_PREFIX_ . 'get_view_settings' );
610
+
611
  $view_settings = array();
612
 
613
  $post_id = PT_CV_Functions::post_id_from_meta_id( $meta_id );
1254
  $data_page = sprintf( 'data-page="%s"', absint( $this_page ) );
1255
  }
1256
 
1257
+ $html = sprintf( '<a %s href="%s">%s</a>', $data_page, get_pagenum_link( $this_page ), $label );
1258
  $class = $class ? sprintf( 'class="%s"', esc_attr( $class ) ) : '';
1259
 
1260
  return sprintf( '<li %s>%s</li>', $class, $html );
1333
  if ( !empty( $pargs[ 'page' ] ) ) {
1334
  $paged = absint( $pargs[ 'page' ] );
1335
  }
1336
+ $pagenum = get_query_var( 'paged' );
1337
+ if ( !empty( $pagenum ) && PT_CV_Functions::setting_value( PT_CV_PREFIX . 'pagination-type' ) === 'normal' ) {
1338
+ $paged = absint( $pagenum );
1339
  }
1340
  }
1341
 
includes/html.php CHANGED
@@ -457,6 +457,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
457
  ob_start();
458
  the_content();
459
  $content = ob_get_clean();
 
460
 
461
  break;
462
  }
457
  ob_start();
458
  the_content();
459
  $content = ob_get_clean();
460
+ $content = apply_filters( PT_CV_PREFIX_ . 'field_content_full', $content, $fargs, $post );
461
 
462
  break;
463
  }
includes/settings.php CHANGED
@@ -886,7 +886,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
886
  array(
887
  'type' => 'html',
888
  'content' => $notice ?
889
- sprintf( '<div class="alert alert-warning cvgopro"><strong>%s:</strong> %s</div>', __( 'Notice', 'content-views-query-and-display-post-page' ), $text . '.' ) :
890
  sprintf( '<p class="text-muted cvgopro" style="%s">&rarr; %s</p>', $style, $text . $url ),
891
  ),
892
  ),
886
  array(
887
  'type' => 'html',
888
  'content' => $notice ?
889
+ sprintf( '<div class="alert alert-warning cvgopro"><strong>%s:</strong> %s</div>', __( 'Notice', 'content-views-query-and-display-post-page' ), $text . $url . '.' ) :
890
  sprintf( '<p class="text-muted cvgopro" style="%s">&rarr; %s</p>', $style, $text . $url ),
891
  ),
892
  ),
includes/values.php CHANGED
@@ -81,7 +81,7 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
81
  $result[ $taxonomy->name ] = $taxonomy->labels->singular_name;
82
  }
83
 
84
- return $result;
85
  }
86
 
87
  /**
81
  $result[ $taxonomy->name ] = $taxonomy->labels->singular_name;
82
  }
83
 
84
+ return apply_filters( PT_CV_PREFIX_ . 'tax_list', $result );
85
  }
86
 
87
  /**
public/content-views.php CHANGED
@@ -97,21 +97,14 @@ class PT_Content_Views {
97
  * activated on an individual blog.
98
  */
99
  public static function activate( $network_wide ) {
100
-
101
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
102
-
103
  if ( $network_wide ) {
104
-
105
- // Get all blog ids
106
  $blog_ids = self::get_blog_ids();
107
-
108
  foreach ( $blog_ids as $blog_id ) {
109
-
110
  switch_to_blog( $blog_id );
111
  self::single_activate();
 
112
  }
113
-
114
- restore_current_blog();
115
  } else {
116
  self::single_activate();
117
  }
@@ -131,21 +124,14 @@ class PT_Content_Views {
131
  * deactivated on an individual blog.
132
  */
133
  public static function deactivate( $network_wide ) {
134
-
135
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
136
-
137
  if ( $network_wide ) {
138
-
139
- // Get all blog ids
140
  $blog_ids = self::get_blog_ids();
141
-
142
  foreach ( $blog_ids as $blog_id ) {
143
-
144
  switch_to_blog( $blog_id );
145
  self::single_deactivate();
 
146
  }
147
-
148
- restore_current_blog();
149
  } else {
150
  self::single_deactivate();
151
  }
97
  * activated on an individual blog.
98
  */
99
  public static function activate( $network_wide ) {
 
100
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
 
101
  if ( $network_wide ) {
 
 
102
  $blog_ids = self::get_blog_ids();
 
103
  foreach ( $blog_ids as $blog_id ) {
 
104
  switch_to_blog( $blog_id );
105
  self::single_activate();
106
+ restore_current_blog();
107
  }
 
 
108
  } else {
109
  self::single_activate();
110
  }
124
  * deactivated on an individual blog.
125
  */
126
  public static function deactivate( $network_wide ) {
 
127
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
 
128
  if ( $network_wide ) {
 
 
129
  $blog_ids = self::get_blog_ids();
 
130
  foreach ( $blog_ids as $blog_id ) {
 
131
  switch_to_blog( $blog_id );
132
  self::single_deactivate();
133
+ restore_current_blog();
134
  }
 
 
135
  } else {
136
  self::single_deactivate();
137
  }