Version Description
- 2022/11/08 =
- Create "Content Views" block in the Block editor. Now you can add a view as block or shortcode.
- Prevent a compatible issue caused by another plugin
- Tweak some texts
Download this release
Release Info
Developer | PT Guy |
Plugin | Content Views – Post Grid & List for WordPress |
Version | 2.5.0 |
Comparing to | |
See all releases |
Code changes from version 2.4.0.7 to 2.5.0
- README.txt +6 -1
- admin/assets/css/admin.css +1 -0
- admin/views/view.php +30 -5
- blocks/editor.css +16 -0
- blocks/index.js +90 -0
- blocks/main.php +145 -0
- content-views.php +3 -2
- includes/compatibility.php +3 -20
- includes/functions.php +1 -0
- includes/html.php +1 -1
- includes/settings.php +4 -3
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.contentviewspro.com/?utm_source=wordpress&utm_medium=pl
|
|
4 |
Tags: post grid, grid plugin, grid, latest post, display post, post list, post, page, category, responsive, list, thumbnail
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 6.1
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -166,6 +166,11 @@ Yes, they are supported in [our Pro version](https://www.contentviewspro.com/?ut
|
|
166 |
|
167 |
== Changelog ==
|
168 |
|
|
|
|
|
|
|
|
|
|
|
169 |
= 2.4.0.7 - 2022/06/20 =
|
170 |
* Fix some layout issues in Add/Edit view page in RTL languages
|
171 |
|
4 |
Tags: post grid, grid plugin, grid, latest post, display post, post list, post, page, category, responsive, list, thumbnail
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 6.1
|
7 |
+
Stable tag: 2.5.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
166 |
|
167 |
== Changelog ==
|
168 |
|
169 |
+
= 2.5.0 - 2022/11/08 =
|
170 |
+
- Create "Content Views" block in the Block editor. Now you can add a view as block or shortcode.
|
171 |
+
- Prevent a compatible issue caused by another plugin
|
172 |
+
- Tweak some texts
|
173 |
+
|
174 |
= 2.4.0.7 - 2022/06/20 =
|
175 |
* Fix some layout issues in Add/Edit view page in RTL languages
|
176 |
|
admin/assets/css/admin.css
CHANGED
@@ -328,6 +328,7 @@ html {
|
|
328 |
}
|
329 |
.pt-wrap .alert {text-align: center}
|
330 |
/*.cvgopro {border: 1px solid #ffc7c9; border-radius: 20px; padding: 5px 15px;}*/
|
|
|
331 |
|
332 |
@media (max-width: 991px) {
|
333 |
#pt-cv-form-view .nav .glyphicon {
|
328 |
}
|
329 |
.pt-wrap .alert {text-align: center}
|
330 |
/*.cvgopro {border: 1px solid #ffc7c9; border-radius: 20px; padding: 5px 15px;}*/
|
331 |
+
p.cvgopro {color: #888; /*background: #fffdf0;*/}
|
332 |
|
333 |
@media (max-width: 991px) {
|
334 |
#pt-cv-form-view .nav .glyphicon {
|
admin/views/view.php
CHANGED
@@ -153,7 +153,7 @@ PT_CV_Functions::view_submit();
|
|
153 |
),
|
154 |
),
|
155 |
// Upgrade to Pro: Custom post type
|
156 |
-
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter custom post type (product, event
|
157 |
apply_filters( PT_CV_PREFIX_ . 'custom_filters', array() ),
|
158 |
// Common Filters
|
159 |
array(
|
@@ -286,8 +286,8 @@ PT_CV_Functions::view_submit();
|
|
286 |
),
|
287 |
),
|
288 |
), // End Advanced Filters
|
289 |
-
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter by custom field', 'content-views-query-and-display-post-page' ) ) : '',
|
290 |
-
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Allow visitors to filter, search, and sort in the
|
291 |
// Settings of Advanced Filters options
|
292 |
array(
|
293 |
'label' => array(
|
@@ -365,7 +365,6 @@ PT_CV_Functions::view_submit();
|
|
365 |
),
|
366 |
),
|
367 |
),
|
368 |
-
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Show this grid view on the Blog, Category, Tag pages and replace the default layout', 'content-views-query-and-display-post-page' ), 12, null, true ) : '',
|
369 |
apply_filters( PT_CV_PREFIX_ . 'taxonomies_custom_settings', array() ),
|
370 |
), // End Taxonomies Settings
|
371 |
// Sort by Settings
|
@@ -478,6 +477,19 @@ PT_CV_Functions::view_submit();
|
|
478 |
),
|
479 |
),
|
480 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
);
|
482 |
echo PT_Options_Framework::do_settings( $options, $settings );
|
483 |
?>
|
@@ -518,7 +530,7 @@ PT_CV_Functions::view_submit();
|
|
518 |
),
|
519 |
),
|
520 |
),
|
521 |
-
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'More amazing layouts (Pinterest, Timeline...)', 'content-views-query-and-display-post-page' ), 10, 'margin-bottom:10px' ) : '',
|
522 |
apply_filters( PT_CV_PREFIX_ . 'more_responsive_settings', array(
|
523 |
'label' => array(
|
524 |
'text' => __( 'Responsive', 'content-views-query-and-display-post-page' ),
|
@@ -700,6 +712,19 @@ PT_CV_Functions::view_submit();
|
|
700 |
),
|
701 |
),
|
702 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
);
|
704 |
|
705 |
$options = apply_filters( PT_CV_PREFIX_ . 'display_settings', $options );
|
153 |
),
|
154 |
),
|
155 |
// Upgrade to Pro: Custom post type
|
156 |
+
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter custom post type (product, event, and so on)', 'content-views-query-and-display-post-page' ) ) : '',
|
157 |
apply_filters( PT_CV_PREFIX_ . 'custom_filters', array() ),
|
158 |
// Common Filters
|
159 |
array(
|
286 |
),
|
287 |
),
|
288 |
), // End Advanced Filters
|
289 |
+
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Filter by custom field, published date', 'content-views-query-and-display-post-page' ) ) : '',
|
290 |
+
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Allow visitors to filter, search, and sort in the front end', 'content-views-query-and-display-post-page' ) ) : '',
|
291 |
// Settings of Advanced Filters options
|
292 |
array(
|
293 |
'label' => array(
|
365 |
),
|
366 |
),
|
367 |
),
|
|
|
368 |
apply_filters( PT_CV_PREFIX_ . 'taxonomies_custom_settings', array() ),
|
369 |
), // End Taxonomies Settings
|
370 |
// Sort by Settings
|
477 |
),
|
478 |
),
|
479 |
),
|
480 |
+
!get_option( 'pt_cv_version_pro' ) ? array(
|
481 |
+
'label' => array(
|
482 |
+
'text' => __( 'Replace Layout', 'content-views-query-and-display-post-page' ),
|
483 |
+
),
|
484 |
+
'params' => array(
|
485 |
+
array(
|
486 |
+
'type' => 'group',
|
487 |
+
'params' => array(
|
488 |
+
PT_CV_Settings::get_cvpro( __( 'Show this grid view on the Blog, Category, Tag, Search pages and replace the default layout', 'content-views-query-and-display-post-page' ), 12, null, true )
|
489 |
+
),
|
490 |
+
),
|
491 |
+
),
|
492 |
+
) : '',
|
493 |
);
|
494 |
echo PT_Options_Framework::do_settings( $options, $settings );
|
495 |
?>
|
530 |
),
|
531 |
),
|
532 |
),
|
533 |
+
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'More amazing layouts (Pinterest, Timeline, Masonry, Glossary ...)', 'content-views-query-and-display-post-page' ), 10, 'margin-bottom:10px' ) : '',
|
534 |
apply_filters( PT_CV_PREFIX_ . 'more_responsive_settings', array(
|
535 |
'label' => array(
|
536 |
'text' => __( 'Responsive', 'content-views-query-and-display-post-page' ),
|
712 |
),
|
713 |
),
|
714 |
),
|
715 |
+
!get_option( 'pt_cv_version_pro' ) ? array(
|
716 |
+
'label' => array(
|
717 |
+
'text' => __( 'Style Settings', 'content-views-query-and-display-post-page' ),
|
718 |
+
),
|
719 |
+
'params' => array(
|
720 |
+
array(
|
721 |
+
'type' => 'group',
|
722 |
+
'params' => array(
|
723 |
+
PT_CV_Settings::get_cvpro( __( 'Change color, font, size, other properties of any texts; padding, margin, text direction, etc. without writing CSS', 'content-views-query-and-display-post-page' ), 12, null, true )
|
724 |
+
),
|
725 |
+
),
|
726 |
+
),
|
727 |
+
) : '',
|
728 |
);
|
729 |
|
730 |
$options = apply_filters( PT_CV_PREFIX_ . 'display_settings', $options );
|
blocks/editor.css
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.content-views-block select {
|
2 |
+
/*line-height: 30px !important;*/
|
3 |
+
max-width: 100% !important;
|
4 |
+
}
|
5 |
+
|
6 |
+
.content-views-block label {
|
7 |
+
display: block !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
.content-views-block a {
|
11 |
+
font-size: 14px;
|
12 |
+
}
|
13 |
+
|
14 |
+
.content-views-block .pt-cv-wrapper * {
|
15 |
+
pointer-events: none !important;
|
16 |
+
}
|
blocks/index.js
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
const { createElement } = wp.element;
|
3 |
+
const { registerBlockType } = wp.blocks;
|
4 |
+
const { serverSideRender: ServerSideRender } = wp;
|
5 |
+
const { InspectorControls } = wp.blockEditor || wp.editor;
|
6 |
+
const { SelectControl, PanelBody } = wp.components;
|
7 |
+
|
8 |
+
registerBlockType( 'content-views/block', {
|
9 |
+
title: ContentViewsBlock.texts.title,
|
10 |
+
description: ContentViewsBlock.texts.description,
|
11 |
+
icon: createElement( 'svg', { xmlms: 'http://www.w3.org/2000/svg', width: 24, height: 24 }, createElement( 'image', { href: ContentViewsBlock.block_icon } ) ),
|
12 |
+
category: 'widgets',
|
13 |
+
keywords: ContentViewsBlock.texts.keywords,
|
14 |
+
|
15 |
+
attributes: {
|
16 |
+
viewId: {
|
17 |
+
type: 'string'
|
18 |
+
}
|
19 |
+
},
|
20 |
+
supports: {
|
21 |
+
// Removes support for an HTML mode.
|
22 |
+
// html: false,
|
23 |
+
},
|
24 |
+
edit: function ( props ) {
|
25 |
+
const attributes = props.attributes;
|
26 |
+
|
27 |
+
var elements = [], inspect_elements = [];
|
28 |
+
|
29 |
+
var select_view = createElement(
|
30 |
+
SelectControl,
|
31 |
+
{
|
32 |
+
key: 'cvblock_select',
|
33 |
+
label: ContentViewsBlock.texts.title,
|
34 |
+
value: attributes.viewId,
|
35 |
+
onChange: function ( value ) {
|
36 |
+
props.setAttributes( { viewId: value } );
|
37 |
+
},
|
38 |
+
options: ContentViewsBlock.views_list
|
39 |
+
}
|
40 |
+
);
|
41 |
+
|
42 |
+
// Inspect Controls
|
43 |
+
inspect_elements.push( select_view );
|
44 |
+
|
45 |
+
if ( attributes.viewId ) {
|
46 |
+
inspect_elements.push( createElement(
|
47 |
+
'a',
|
48 |
+
{
|
49 |
+
key: 'cvblock_edit',
|
50 |
+
href: ContentViewsBlock.edit_link.replace( 'VIEWID', attributes.viewId ),
|
51 |
+
target: '_blank'
|
52 |
+
},
|
53 |
+
ContentViewsBlock.texts.edit
|
54 |
+
) );
|
55 |
+
}
|
56 |
+
|
57 |
+
elements.push( createElement(
|
58 |
+
InspectorControls,
|
59 |
+
{ key: 'cvblock_controls' },
|
60 |
+
createElement(
|
61 |
+
PanelBody,
|
62 |
+
{
|
63 |
+
key: 'cvblock_controls_body'
|
64 |
+
},
|
65 |
+
inspect_elements
|
66 |
+
)
|
67 |
+
) );
|
68 |
+
|
69 |
+
// Editor
|
70 |
+
if ( attributes.viewId ) {
|
71 |
+
elements.push( createElement(
|
72 |
+
ServerSideRender,
|
73 |
+
{
|
74 |
+
key: 'cvblock_preview',
|
75 |
+
block: 'content-views/block',
|
76 |
+
attributes: attributes
|
77 |
+
}
|
78 |
+
) );
|
79 |
+
} else {
|
80 |
+
elements.push( select_view );
|
81 |
+
}
|
82 |
+
|
83 |
+
return createElement(
|
84 |
+
'div', { className: 'content-views-block' }, elements
|
85 |
+
);
|
86 |
+
},
|
87 |
+
save: function () {
|
88 |
+
return null;
|
89 |
+
}
|
90 |
+
} );
|
blocks/main.php
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Functions to register client-side assets (scripts and stylesheets) for the
|
4 |
+
* Gutenberg block.
|
5 |
+
*
|
6 |
+
* @package content-views-query-and-display-post-page
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( !defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
add_action( 'init', 'contentviews_block_init' );
|
14 |
+
function contentviews_block_init() {
|
15 |
+
// Skip block registration if Gutenberg is not enabled/merged.
|
16 |
+
if ( ! function_exists( 'register_block_type' ) ) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
wp_register_style(
|
21 |
+
'contentviews-block-style',
|
22 |
+
plugins_url( 'editor.css', __FILE__ ),
|
23 |
+
array(),
|
24 |
+
PT_CV_VERSION
|
25 |
+
);
|
26 |
+
|
27 |
+
wp_register_script(
|
28 |
+
'contentviews-block-script',
|
29 |
+
plugins_url( 'index.js', __FILE__ ),
|
30 |
+
array(
|
31 |
+
'wp-blocks',
|
32 |
+
'wp-i18n',
|
33 |
+
'wp-element',
|
34 |
+
'wp-components'
|
35 |
+
),
|
36 |
+
PT_CV_VERSION,
|
37 |
+
true // in footer is required
|
38 |
+
);
|
39 |
+
|
40 |
+
register_block_type( 'content-views/block', array(
|
41 |
+
'attributes' => [
|
42 |
+
'viewId' => [
|
43 |
+
'type' => 'string',
|
44 |
+
]
|
45 |
+
],
|
46 |
+
'editor_style' => 'contentviews-block-style',
|
47 |
+
'editor_script' => 'contentviews-block-script',
|
48 |
+
'render_callback' => 'contentviews_block_output',
|
49 |
+
// https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/
|
50 |
+
// maybe, if WP before 5.9 to show raw shortcode. otherwise, show full output
|
51 |
+
// 'style' => '',
|
52 |
+
// 'script' => '',
|
53 |
+
) );
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
add_action( 'enqueue_block_editor_assets', 'contentviews_block_enqueue_assets' );
|
58 |
+
function contentviews_block_enqueue_assets() {
|
59 |
+
$js_data = array(
|
60 |
+
'views_list' => contentviews_get_views_list(),
|
61 |
+
'edit_link' => PT_CV_Functions::view_link( 'VIEWID' ),
|
62 |
+
'block_icon' => plugins_url( 'admin/assets/images/icon.png', PT_CV_FILE ),
|
63 |
+
'texts' => array(
|
64 |
+
'title' => 'Content Views',
|
65 |
+
'description' => __( 'Select and display one of your views.', 'content-views-query-and-display-post-page' ),
|
66 |
+
'keywords' => [
|
67 |
+
'content',
|
68 |
+
__( 'grid', 'content-views-query-and-display-post-page' ),
|
69 |
+
__( 'content', 'content-views-query-and-display-post-page' ),
|
70 |
+
__( 'view', 'content-views-query-and-display-post-page' ),
|
71 |
+
__( 'post', 'content-views-query-and-display-post-page' ),
|
72 |
+
],
|
73 |
+
'edit' => __( 'Edit View', 'content-views-query-and-display-post-page' ),
|
74 |
+
),
|
75 |
+
);
|
76 |
+
|
77 |
+
wp_localize_script(
|
78 |
+
'contentviews-block-script',
|
79 |
+
'ContentViewsBlock',
|
80 |
+
$js_data
|
81 |
+
);
|
82 |
+
}
|
83 |
+
|
84 |
+
function contentviews_block_output( $attr ) {
|
85 |
+
$id = !empty( $attr[ 'viewId' ] ) ? cv_sanitize_vid( $attr[ 'viewId' ] ) : 0;
|
86 |
+
|
87 |
+
if ( empty( $id ) ) {
|
88 |
+
return '';
|
89 |
+
}
|
90 |
+
|
91 |
+
$output = '';
|
92 |
+
$is_gb_editor = defined( 'REST_REQUEST' ) && REST_REQUEST && !empty( $_REQUEST[ 'context' ] ) && $_REQUEST[ 'context' ] === 'edit';
|
93 |
+
if ( $is_gb_editor ) {
|
94 |
+
#$output .= '<p style="background:#ececec; text-align:center;">' . __( 'Some functions do not work here. Please preview this post to see fully functional output.', 'content-views-query-and-display-post-page' ) . '</p>';
|
95 |
+
|
96 |
+
PT_CV_Html::frontend_styles();
|
97 |
+
#PT_CV_Html::frontend_scripts();
|
98 |
+
|
99 |
+
ob_start();
|
100 |
+
wp_print_styles( PT_CV_PREFIX . 'public-style' );
|
101 |
+
wp_print_styles( PT_CV_PREFIX . 'public-pro-style' );
|
102 |
+
#wp_print_scripts( PT_CV_PREFIX . 'content-views-script' );
|
103 |
+
#wp_print_scripts( PT_CV_PREFIX . 'public-pro-script' );
|
104 |
+
$output .= ob_get_clean();
|
105 |
+
#$output = preg_replace( '/<script[^>]*jquery[^>]*><\/script>/', '', $output );
|
106 |
+
|
107 |
+
// disable Pro lazyload, as it might not work in backend block editor
|
108 |
+
add_filter( PT_CV_PREFIX_ . 'do_lazy_image', '__return_false' );
|
109 |
+
}
|
110 |
+
|
111 |
+
ob_start();
|
112 |
+
echo do_shortcode( "[pt_view id='$id']" );
|
113 |
+
$output .= ob_get_clean();
|
114 |
+
|
115 |
+
return $output;
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
function contentviews_get_views_list() {
|
120 |
+
$result = array(
|
121 |
+
array(
|
122 |
+
'value' => '',
|
123 |
+
'label' => __( 'Select a View', 'content-views-query-and-display-post-page' )
|
124 |
+
)
|
125 |
+
);
|
126 |
+
|
127 |
+
$views = get_posts( array(
|
128 |
+
'suppress_filters' => true,
|
129 |
+
'post_type' => PT_CV_POST_TYPE,
|
130 |
+
'post_status' => 'publish',
|
131 |
+
'posts_per_page' => -1
|
132 |
+
) );
|
133 |
+
|
134 |
+
foreach ( $views as $view ) {
|
135 |
+
$viewid = get_post_meta( $view->ID, PT_CV_META_ID, true );
|
136 |
+
if ( $viewid ) {
|
137 |
+
$result[] = array(
|
138 |
+
'value' => $viewid,
|
139 |
+
'label' => apply_filters( 'the_title', $view->post_title, $view->ID )
|
140 |
+
);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
// error_log( 'get views list executed' );
|
144 |
+
return $result;
|
145 |
+
}
|
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: 2.
|
14 |
* Author: Content Views
|
15 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
16 |
* Text Domain: content-views-query-and-display-post-page
|
@@ -24,7 +24,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
24 |
}
|
25 |
|
26 |
// Define Constant
|
27 |
-
define( 'PT_CV_VERSION', '2.
|
28 |
define( 'PT_CV_FILE', __FILE__ );
|
29 |
define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
|
30 |
include_once( PT_CV_PATH . 'includes/defines.php' );
|
@@ -40,6 +40,7 @@ include_once( PT_CV_PATH . 'includes/html.php' );
|
|
40 |
include_once( PT_CV_PATH . 'includes/settings.php' );
|
41 |
include_once( PT_CV_PATH . 'includes/update.php' );
|
42 |
include_once( PT_CV_PATH . 'includes/values.php' );
|
|
|
43 |
|
44 |
// Main file
|
45 |
include_once( PT_CV_PATH . 'public/content-views.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.5.0
|
14 |
* Author: Content Views
|
15 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
16 |
* Text Domain: content-views-query-and-display-post-page
|
24 |
}
|
25 |
|
26 |
// Define Constant
|
27 |
+
define( 'PT_CV_VERSION', '2.5.0' );
|
28 |
define( 'PT_CV_FILE', __FILE__ );
|
29 |
define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
|
30 |
include_once( PT_CV_PATH . 'includes/defines.php' );
|
40 |
include_once( PT_CV_PATH . 'includes/settings.php' );
|
41 |
include_once( PT_CV_PATH . 'includes/update.php' );
|
42 |
include_once( PT_CV_PATH . 'includes/values.php' );
|
43 |
+
include_once( PT_CV_PATH . 'blocks/main.php' );
|
44 |
|
45 |
// Main file
|
46 |
include_once( PT_CV_PATH . 'public/content-views.php' );
|
includes/compatibility.php
CHANGED
@@ -152,6 +152,9 @@ add_action( 'pre_get_posts', 'cv_comp_no_view_found', 999 );
|
|
152 |
function cv_comp_no_view_found( $query ) {
|
153 |
if ( $query->get( 'cv_get_view' ) ) {
|
154 |
$query->set( 'post_type', PT_CV_POST_TYPE );
|
|
|
|
|
|
|
155 |
}
|
156 |
|
157 |
return $query;
|
@@ -438,23 +441,3 @@ function cvp_comp_plugin_easyfootnotes() {
|
|
438 |
}
|
439 |
}
|
440 |
|
441 |
-
/** Prevent "whp-hide-posts" from causing multiple views on same page show same output
|
442 |
-
* @since 2.3.1
|
443 |
-
*/
|
444 |
-
add_action( 'pre_get_posts', 'cv_comp_plugin_wph', 1 );
|
445 |
-
function cv_comp_plugin_wph( $query ) {
|
446 |
-
$hook = 'pre_get_posts';
|
447 |
-
$class = 'WHP_Post_Hide';
|
448 |
-
$priority = 10;
|
449 |
-
if ( $query->get( 'cv_get_view' ) && class_exists( $class ) && !empty( $GLOBALS[ 'wp_filter' ][ $hook ][ $priority ] ) ) {
|
450 |
-
$arr = (array) $GLOBALS[ 'wp_filter' ][ $hook ][ $priority ];
|
451 |
-
foreach ( array_keys( $arr ) as $filter ) {
|
452 |
-
if ( strpos( $filter, 'exclude_posts' ) !== false ) {
|
453 |
-
if ( !empty( $arr[ $filter ][ 'function' ][ 0 ] ) && is_a( $arr[ $filter ][ 'function' ][ 0 ], $class ) ) {
|
454 |
-
remove_filter( $hook, $filter, $priority );
|
455 |
-
}
|
456 |
-
}
|
457 |
-
}
|
458 |
-
}
|
459 |
-
return $query;
|
460 |
-
}
|
152 |
function cv_comp_no_view_found( $query ) {
|
153 |
if ( $query->get( 'cv_get_view' ) ) {
|
154 |
$query->set( 'post_type', PT_CV_POST_TYPE );
|
155 |
+
// prevent /whp-hide-posts/ exclude_posts() from causing all views on same page to show the same content
|
156 |
+
$query->set( 'meta_key', PT_CV_META_ID );
|
157 |
+
$query->set( 'meta_compare', '=' );
|
158 |
}
|
159 |
|
160 |
return $query;
|
441 |
}
|
442 |
}
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions.php
CHANGED
@@ -300,6 +300,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
300 |
static function trim_words( $text, $num_words ) {
|
301 |
$more = '';
|
302 |
$text = apply_filters( PT_CV_PREFIX_ . 'before_trim_words', $text );
|
|
|
303 |
|
304 |
/*
|
305 |
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
300 |
static function trim_words( $text, $num_words ) {
|
301 |
$more = '';
|
302 |
$text = apply_filters( PT_CV_PREFIX_ . 'before_trim_words', $text );
|
303 |
+
$num_words = apply_filters( PT_CV_PREFIX_ . 'trim_words_number', $num_words );
|
304 |
|
305 |
/*
|
306 |
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
includes/html.php
CHANGED
@@ -867,7 +867,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
867 |
static function get_readmore_text( $args ) {
|
868 |
$result = '';
|
869 |
if ( !empty( $args[ 'readmore-text' ] ) ) {
|
870 |
-
$result = stripslashes( cv_sanitize_tag_content( $args[ 'readmore-text' ] ) );
|
871 |
// CV translation
|
872 |
if ( $result === 'Read More' ) {
|
873 |
$result = __( 'Read More', 'content-views-query-and-display-post-page' );
|
867 |
static function get_readmore_text( $args ) {
|
868 |
$result = '';
|
869 |
if ( !empty( $args[ 'readmore-text' ] ) ) {
|
870 |
+
$result = stripslashes( cv_sanitize_tag_content( apply_filters( PT_CV_PREFIX_ . 'maybe_translate', $args[ 'readmore-text' ], 'read more text' ) ) );
|
871 |
// CV translation
|
872 |
if ( $result === 'Read More' ) {
|
873 |
$result = __( 'Read More', 'content-views-query-and-display-post-page' );
|
includes/settings.php
CHANGED
@@ -696,8 +696,9 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
|
|
696 |
),
|
697 |
),
|
698 |
),
|
|
|
699 |
// Upgrade to Pro: Show image/video in content as thumbnail
|
700 |
-
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( sprintf( __( 'In this lite version, thumbnail is only shown if the post has %s.<br>In the Pro version, you can show the first image in post as thumbnail, without having to set a featured image', 'content-views-query-and-display-post-page' ), sprintf( '<a target="_blank" href="https://codex.wordpress.org/Post_Thumbnails">%s</a>', __( 'Featured Image' ) ) ), 12, null, true ) : '',
|
701 |
);
|
702 |
|
703 |
$result = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_settings', $result, $prefix );
|
@@ -870,7 +871,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
|
|
870 |
$prefix = 'scrollable-';
|
871 |
|
872 |
$result = array(
|
873 |
-
PT_CV_Settings::
|
874 |
);
|
875 |
|
876 |
$result = apply_filters( PT_CV_PREFIX_ . 'view_type_settings_scrollable', $result );
|
@@ -916,7 +917,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
|
|
916 |
* @return string
|
917 |
*/
|
918 |
static function get_cvpro( $text, $width = 10, $style = '', $notice = false ) {
|
919 |
-
$url = sprintf( ' » <a href="%s" target="_blank">%s</a>', esc_url( 'https://www.contentviewspro.com
|
920 |
|
921 |
return array(
|
922 |
'label' => array(
|
696 |
),
|
697 |
),
|
698 |
),
|
699 |
+
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( __( 'Show images in same size, set a custom size, overlay image with text, lazyload images', 'content-views-query-and-display-post-page' ) ) : '',
|
700 |
// Upgrade to Pro: Show image/video in content as thumbnail
|
701 |
+
!get_option( 'pt_cv_version_pro' ) ? PT_CV_Settings::get_cvpro( sprintf( __( 'In this lite version, thumbnail is only shown if the post has %s.<br>In the Pro version, you can show the first image/video in post as thumbnail, without having to set a featured image', 'content-views-query-and-display-post-page' ), sprintf( '<a target="_blank" href="https://codex.wordpress.org/Post_Thumbnails">%s</a>', __( 'Featured Image' ) ) ), 12, null, true ) : '',
|
702 |
);
|
703 |
|
704 |
$result = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_settings', $result, $prefix );
|
871 |
$prefix = 'scrollable-';
|
872 |
|
873 |
$result = array(
|
874 |
+
PT_CV_Settings::get_cvpro( __( 'Increase columns and rows in each slide, automatically cycle', 'content-views-query-and-display-post-page' ), 12, 'margin-top: 5px; margin-bottom: -5px;' )
|
875 |
);
|
876 |
|
877 |
$result = apply_filters( PT_CV_PREFIX_ . 'view_type_settings_scrollable', $result );
|
917 |
* @return string
|
918 |
*/
|
919 |
static function get_cvpro( $text, $width = 10, $style = '', $notice = false ) {
|
920 |
+
$url = sprintf( ' » <a href="%s" target="_blank">%s</a>', esc_url( 'https://www.contentviewspro.com/?utm_source=client&utm_medium=view_fields&utm_campaign=gopro' ), __( 'get Pro version', 'content-views-query-and-display-post-page' ) );
|
921 |
|
922 |
return array(
|
923 |
'label' => array(
|