Version Description
- Add option to Settings page to enable/disable load Bootstrap in frontend
- Enable to search by View ID in "All Views" page
- Fix bug Scrollable List (when slide count
Download this release
Release Info
Developer | PT Guy |
Plugin | Content Views – Post Grid & List for WordPress |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
- README.txt +57 -26
- admin/assets/images/features/content-type.png +0 -0
- admin/assets/images/features/orderby.png +0 -0
- admin/assets/images/features/pinterest.png +0 -0
- admin/assets/images/features/scrollable.png +0 -0
- admin/assets/images/features/timeline.png +0 -0
- admin/assets/images/features/woocommerce.png +0 -0
- admin/assets/js/admin.js +24 -8
- admin/content-views-admin.php +5 -2
- admin/includes/plugin.php +203 -0
- admin/includes/templates/settings-section-one.php +2 -0
- admin/includes/templates/settings-section-two.php +121 -0
- admin/views/admin.php +7 -117
- admin/views/view.php +8 -3
- content-views.php +5 -2
- includes/functions.php +19 -3
- includes/html-viewtype.php +24 -18
- includes/html.php +25 -5
- includes/settings.php +3 -1
- public/assets/css/public.css +3 -1
- public/templates/scrollable/html/main.php +2 -1
README.txt
CHANGED
@@ -1,43 +1,59 @@
|
|
1 |
-
=== Query and display posts without coding - Content Views ===
|
2 |
Contributors: pt-guy
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
|
4 |
Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, collapsible, list, slide, layout, ui
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.9.1
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
Query and display <strong>posts
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
|
16 |
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
**in Step 1, you can:**
|
24 |
|
25 |
-
* query single/multiple post(s)
|
26 |
* query child pages of a parent page
|
27 |
-
* query posts
|
28 |
-
* query posts
|
29 |
-
* query posts
|
30 |
-
* query posts
|
31 |
-
* sort posts
|
32 |
|
33 |
**in Step 2, you can:**
|
34 |
|
35 |
-
* Select a layout to
|
36 |
* Choose a layout format of each item (item is the output of a post, page at front-end): 1 column, 2 columns
|
37 |
-
* Select fields to
|
38 |
-
* Select size of thumbnail
|
39 |
-
*
|
40 |
-
* Select meta fields to
|
41 |
* Enable/Disable pagination
|
42 |
* Open an item in new tab, current tab
|
43 |
|
@@ -46,16 +62,18 @@ Also, you can import/export 'View' to use in other WordPress sites (Please check
|
|
46 |
|
47 |
= More amazing features: =
|
48 |
|
49 |
-
* Be able to query custom post types (Woocommerce products, FAQ...)
|
50 |
* More beautiful output & powerful settings of Grid, Collapsible List, Scrollable List
|
51 |
-
*
|
52 |
* Drag & drop to change display order of fields (thumbnail, title, content, meta fields)
|
53 |
-
* Customize Font settings
|
54 |
-
* Customize Read more button
|
55 |
-
*
|
56 |
* And much more...
|
57 |
|
58 |
-
are available in **[Content Views PRO](http://www.
|
|
|
|
|
59 |
|
60 |
|
61 |
== Installation ==
|
@@ -100,7 +118,10 @@ In left menu of your Admin dashboard, click Content View Settings > All Views
|
|
100 |
|
101 |
= How can I edit a View? =
|
102 |
|
103 |
-
Firstly, you should go to "All Views" page (please check above question).
|
|
|
|
|
|
|
104 |
|
105 |
= How to get UNIQUE_ID of View? =
|
106 |
|
@@ -124,6 +145,13 @@ You can create Unlimited Views, in Unlimited websites
|
|
124 |
|
125 |
== Changelog ==
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
= 1.1.2 =
|
128 |
* Fix offset bug
|
129 |
|
@@ -152,6 +180,9 @@ You can create Unlimited Views, in Unlimited websites
|
|
152 |
|
153 |
== Upgrade Notice ==
|
154 |
|
|
|
|
|
|
|
155 |
= 1.1.2 =
|
156 |
Fix offset bug
|
157 |
|
1 |
+
=== Query posts and display posts without coding - Content Views ===
|
2 |
Contributors: pt-guy
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
|
4 |
Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, collapsible, list, slide, layout, ui
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.9.1
|
7 |
+
Stable tag: 1.1.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Query and display <strong>posts</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Have you ever wanted to:
|
16 |
|
17 |
+
* display recent posts in grid 3x3
|
18 |
+
* display posts in descending order of Title
|
19 |
+
* replace boring Next, Prev button of WordPress theme by a beautiful pagination
|
20 |
+
* display thumbnail in different size than 150x150 or 300x300
|
21 |
+
* display posts of a specific author
|
22 |
+
* display posts which have a specific tag or in a specific category
|
23 |
+
?
|
24 |
|
25 |
+
How do you do?
|
26 |
+
|
27 |
+
It is not easy as ABC, isn't it?
|
28 |
+
|
29 |
+
But now, with Content Views plugin, you can do above things in seconds, without any line of code.
|
30 |
+
|
31 |
+
[Content Views plugin](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=post&utm_campaign=content-views "Visit Content Views website") provides a visual form to query posts and display posts in **responsive** layouts (grid, scrollable list, collapsible list) quickly & easily, in very 3 simple steps:
|
32 |
+
|
33 |
+
* Step 1 : Select criteria (author, category, tag...) to query your wanted posts
|
34 |
+
* Step 2 : Select a nice layout to display posts
|
35 |
+
* Step 3 : Paste shortcode **[pt_view id="UNIQUE_ID"]** to editor of a post, page or a Text widget where you want to display your posts. If you are a developer, you can **`<?php echo do_shortcode('[pt_view id="UNIQUE_ID"]'); ?>`** in current theme of your WordPress site. (Please check FAQ to know how to get UNIQUE_ID of View)
|
36 |
+
|
37 |
+
= A features list of Content Views plugin: =
|
38 |
|
39 |
**in Step 1, you can:**
|
40 |
|
41 |
+
* query single/multiple post(s)
|
42 |
* query child pages of a parent page
|
43 |
+
* query posts written by, not written by authors
|
44 |
+
* query posts associate with, not associate with categories, tags
|
45 |
+
* query posts in any status (publish, draft, private...)
|
46 |
+
* query posts which contain a specific keyword
|
47 |
+
* sort posts by Id, Title, Created date, Modified date in ascending, descending order
|
48 |
|
49 |
**in Step 2, you can:**
|
50 |
|
51 |
+
* Select a layout to display posts: Grid, Collapsible List, Scrollable List. More awesome layouts are available in **[Content Views PRO](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=plugin&utm_campaign=content-views "Content Views Pro plugin")**
|
52 |
* Choose a layout format of each item (item is the output of a post, page at front-end): 1 column, 2 columns
|
53 |
+
* Select fields to display (thumbnail, title, content, meta fields)
|
54 |
+
* Select size of thumbnail to display
|
55 |
+
* Display full content, or display only excerpt with specific amount of words
|
56 |
+
* Select meta fields to display (date, author, terms [categories, tags], comment count)
|
57 |
* Enable/Disable pagination
|
58 |
* Open an item in new tab, current tab
|
59 |
|
62 |
|
63 |
= More amazing features: =
|
64 |
|
65 |
+
* Be able to query and display custom post types (Woocommerce products, FAQ...)
|
66 |
* More beautiful output & powerful settings of Grid, Collapsible List, Scrollable List
|
67 |
+
* Display posts in more Awesome layouts: Pinterest, Timeline
|
68 |
* Drag & drop to change display order of fields (thumbnail, title, content, meta fields)
|
69 |
+
* Customize Font settings for Title, Content
|
70 |
+
* Customize style & text of "Read more" button
|
71 |
+
* Additional pagination option
|
72 |
* And much more...
|
73 |
|
74 |
+
are available in **[Content Views PRO](http://www.contentviewspro.com/?utm_source=wordpress&utm_medium=plugin&utm_campaign=content-views "Content Views Pro")** plugin.
|
75 |
+
|
76 |
+
Just give a try (30 day money back guarantee), then you will know how it is awesome :)
|
77 |
|
78 |
|
79 |
== Installation ==
|
118 |
|
119 |
= How can I edit a View? =
|
120 |
|
121 |
+
Firstly, you should go to "All Views" page (please check above question).
|
122 |
+
If you have View ID or View title, paste it to the text field beside of "Search Views" button then click that button.
|
123 |
+
Then click on Title of View you want to edit.
|
124 |
+
You will be forwarded to editing page of View.
|
125 |
|
126 |
= How to get UNIQUE_ID of View? =
|
127 |
|
145 |
|
146 |
== Changelog ==
|
147 |
|
148 |
+
= 1.1.3 =
|
149 |
+
* Add option to Settings page to enable/disable load Bootstrap in frontend
|
150 |
+
* Enable to search by View ID in "All Views" page
|
151 |
+
* Fix bug Scrollable List (when slide count = 1)
|
152 |
+
* Update settings page
|
153 |
+
* Add some custom filters
|
154 |
+
|
155 |
= 1.1.2 =
|
156 |
* Fix offset bug
|
157 |
|
180 |
|
181 |
== Upgrade Notice ==
|
182 |
|
183 |
+
= 1.1.3 =
|
184 |
+
Add option to Settings page to enable/disable load Bootstrap in frontend. Enable to search by View ID in "All Views" page. Fix bug Scrollable List (when slide count = 1). Update settings page. Add some custom filters
|
185 |
+
|
186 |
= 1.1.2 =
|
187 |
Fix offset bug
|
188 |
|
admin/assets/images/features/content-type.png
DELETED
Binary file
|
admin/assets/images/features/orderby.png
DELETED
Binary file
|
admin/assets/images/features/pinterest.png
CHANGED
Binary file
|
admin/assets/images/features/scrollable.png
CHANGED
Binary file
|
admin/assets/images/features/timeline.png
CHANGED
Binary file
|
admin/assets/images/features/woocommerce.png
ADDED
Binary file
|
admin/assets/js/admin.js
CHANGED
@@ -323,7 +323,7 @@
|
|
323 |
if ( typeof this_val === 'undefined' ) {
|
324 |
return;
|
325 |
}
|
326 |
-
|
327 |
if (is_change) {
|
328 |
// Uncheck all checkbox of taxonomies
|
329 |
$taxonomies.attr('checked', false);
|
@@ -595,17 +595,13 @@
|
|
595 |
fn_selector($(selector + ':checked').val());
|
596 |
});
|
597 |
},
|
598 |
-
|
599 |
-
|
600 |
-
* @returns {undefined}
|
601 |
-
*/
|
602 |
-
custom : function () {
|
603 |
|
604 |
var $self = this;
|
605 |
var _prefix = $self.options._prefix;
|
606 |
|
607 |
-
|
608 |
-
$('input, select, textarea', '.pt-wrap .tab-content').change(function () {
|
609 |
$self.options.onload = 0;
|
610 |
|
611 |
// Toggle text of this button
|
@@ -613,8 +609,28 @@
|
|
613 |
|
614 |
// Enable preview
|
615 |
$self.options.can_preview = 1;
|
|
|
|
|
|
|
|
|
616 |
});
|
617 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
// Custom JS for Content Type
|
619 |
$self._content_type();
|
620 |
|
323 |
if ( typeof this_val === 'undefined' ) {
|
324 |
return;
|
325 |
}
|
326 |
+
|
327 |
if (is_change) {
|
328 |
// Uncheck all checkbox of taxonomies
|
329 |
$taxonomies.attr('checked', false);
|
595 |
fn_selector($(selector + ':checked').val());
|
596 |
});
|
597 |
},
|
598 |
+
|
599 |
+
_preview_btn_toggle : function(){
|
|
|
|
|
|
|
600 |
|
601 |
var $self = this;
|
602 |
var _prefix = $self.options._prefix;
|
603 |
|
604 |
+
var _fn = function(){
|
|
|
605 |
$self.options.onload = 0;
|
606 |
|
607 |
// Toggle text of this button
|
609 |
|
610 |
// Enable preview
|
611 |
$self.options.can_preview = 1;
|
612 |
+
};
|
613 |
+
// Bind on change input after page load
|
614 |
+
$('input, select, textarea', '.pt-wrap .tab-content').change(function () {
|
615 |
+
_fn();
|
616 |
});
|
617 |
|
618 |
+
$('body').bind(_prefix + 'preview-btn-toggle', function () {
|
619 |
+
_fn();
|
620 |
+
});
|
621 |
+
},
|
622 |
+
|
623 |
+
/**
|
624 |
+
* Custom js for elements
|
625 |
+
* @returns {undefined}
|
626 |
+
*/
|
627 |
+
custom : function () {
|
628 |
+
|
629 |
+
var $self = this;
|
630 |
+
var _prefix = $self.options._prefix;
|
631 |
+
|
632 |
+
$self._preview_btn_toggle();
|
633 |
+
|
634 |
// Custom JS for Content Type
|
635 |
$self._content_type();
|
636 |
|
admin/content-views-admin.php
CHANGED
@@ -88,6 +88,9 @@ class PT_Content_Views_Admin {
|
|
88 |
|
89 |
// Custom hooks for both preview & frontend
|
90 |
PT_CV_Hooks::init();
|
|
|
|
|
|
|
91 |
}
|
92 |
|
93 |
/**
|
@@ -191,7 +194,7 @@ class PT_Content_Views_Admin {
|
|
191 |
}
|
192 |
|
193 |
// For Preview
|
194 |
-
PT_CV_Html::frontend_styles();
|
195 |
|
196 |
// Main scripts
|
197 |
PT_CV_Asset::enqueue( 'select2', 'style' );
|
@@ -246,7 +249,7 @@ class PT_Content_Views_Admin {
|
|
246 |
);
|
247 |
|
248 |
// For Preview
|
249 |
-
PT_CV_Html::frontend_scripts();
|
250 |
|
251 |
PT_CV_Asset::enqueue( 'select2' );
|
252 |
}
|
88 |
|
89 |
// Custom hooks for both preview & frontend
|
90 |
PT_CV_Hooks::init();
|
91 |
+
|
92 |
+
// Custom settings page
|
93 |
+
PT_CV_Plugin::init();
|
94 |
}
|
95 |
|
96 |
/**
|
194 |
}
|
195 |
|
196 |
// For Preview
|
197 |
+
PT_CV_Html::frontend_styles( true );
|
198 |
|
199 |
// Main scripts
|
200 |
PT_CV_Asset::enqueue( 'select2', 'style' );
|
249 |
);
|
250 |
|
251 |
// For Preview
|
252 |
+
PT_CV_Html::frontend_scripts( true );
|
253 |
|
254 |
PT_CV_Asset::enqueue( 'select2' );
|
255 |
}
|
admin/includes/plugin.php
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Form, option group, option name, option fields
|
5 |
+
*
|
6 |
+
* @package PT_Content_Views
|
7 |
+
* @author Palace Of Themes <palaceofthemes@gmail.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link http://example.com
|
10 |
+
* @copyright 2014 Palace Of Themes
|
11 |
+
*/
|
12 |
+
if ( ! class_exists( 'PT_CV_Plugin' ) ) {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @name PT_CV_Plugin
|
16 |
+
*/
|
17 |
+
class PT_CV_Plugin {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Holds the values to be used in the fields callbacks
|
21 |
+
*/
|
22 |
+
static $options;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Add custom filters/actions
|
26 |
+
*/
|
27 |
+
static function init() {
|
28 |
+
|
29 |
+
// Action
|
30 |
+
add_action( 'admin_init', array( __CLASS__, 'register_settings' ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Content Views Settings page : section 1
|
35 |
+
*/
|
36 |
+
public static function settings_page_section_one() {
|
37 |
+
|
38 |
+
$file_path = plugin_dir_path( PT_CV_FILE ) . 'admin/includes/templates/settings-section-one.php';
|
39 |
+
|
40 |
+
$text = PT_CV_Functions::file_include_content( $file_path );
|
41 |
+
|
42 |
+
$text = apply_filters( PT_CV_PREFIX_ . 'settings_page_section_one', $text );
|
43 |
+
|
44 |
+
echo balanceTags( $text );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Content Views Settings page : section 2
|
49 |
+
*/
|
50 |
+
public static function settings_page_section_two() {
|
51 |
+
|
52 |
+
$file_path = plugin_dir_path( PT_CV_FILE ) . 'admin/includes/templates/settings-section-two.php';
|
53 |
+
|
54 |
+
$text = PT_CV_Functions::file_include_content( $file_path );
|
55 |
+
|
56 |
+
$text = apply_filters( PT_CV_PREFIX_ . 'settings_page_section_two', $text );
|
57 |
+
|
58 |
+
echo balanceTags( $text );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Form in Settings page
|
63 |
+
*/
|
64 |
+
public static function settings_page_form() {
|
65 |
+
ob_start();
|
66 |
+
|
67 |
+
self::$options = get_option( PT_CV_OPTION_NAME );
|
68 |
+
?>
|
69 |
+
<form method="post" action="options.php">
|
70 |
+
<?php
|
71 |
+
// This prints out all hidden setting fields
|
72 |
+
settings_fields( PT_CV_OPTION_NAME . '_group' );
|
73 |
+
do_settings_sections( PT_CV_DOMAIN );
|
74 |
+
submit_button();
|
75 |
+
?>
|
76 |
+
</form>
|
77 |
+
<?php
|
78 |
+
$text = ob_get_clean();
|
79 |
+
|
80 |
+
echo balanceTags( $text );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Register option group, option name, option fields
|
85 |
+
*/
|
86 |
+
public static function register_settings() {
|
87 |
+
|
88 |
+
register_setting(
|
89 |
+
PT_CV_OPTION_NAME . '_group', // Option group
|
90 |
+
PT_CV_OPTION_NAME, // Option name
|
91 |
+
array( __CLASS__, 'field_sanitize' ) // Sanitize
|
92 |
+
);
|
93 |
+
|
94 |
+
// Common setting Section
|
95 |
+
$this_section = 'setting_unload_bootstrap';
|
96 |
+
add_settings_section(
|
97 |
+
$this_section, // ID
|
98 |
+
__( '', PT_CV_DOMAIN ), // Title
|
99 |
+
array( __CLASS__, 'section_callback_setting_unload_bootstrap' ), // Callback
|
100 |
+
PT_CV_DOMAIN // Page
|
101 |
+
);
|
102 |
+
|
103 |
+
// Define Common setting fields
|
104 |
+
$account_fields = array(
|
105 |
+
array(
|
106 |
+
'id' => 'unload_bootstrap',
|
107 |
+
'title' => '<strong>' . __( 'Frontend assets', PT_CV_DOMAIN ) . '</strong>',
|
108 |
+
),
|
109 |
+
);
|
110 |
+
|
111 |
+
// Register Common setting fields
|
112 |
+
foreach ( $account_fields as $field ) {
|
113 |
+
self::field_register( $field, $this_section );
|
114 |
+
}
|
115 |
+
|
116 |
+
do_action( PT_CV_PREFIX_ . 'settings_page' );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Sanitize each setting field as needed
|
121 |
+
*
|
122 |
+
* @param array $input Contains all settings fields as array keys
|
123 |
+
*/
|
124 |
+
public static function field_sanitize( $input ) {
|
125 |
+
$new_input = array();
|
126 |
+
|
127 |
+
foreach ( $input as $key => $value ) {
|
128 |
+
$new_input[$key] = sanitize_text_field( $value );
|
129 |
+
}
|
130 |
+
|
131 |
+
return $new_input;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Add settings field
|
136 |
+
*
|
137 |
+
* @param array $field_info Field information
|
138 |
+
* @param string $section Id of setting section
|
139 |
+
* @param string $class Class name to find the callback function
|
140 |
+
*/
|
141 |
+
public static function field_register( $field_info, $section, $class = __CLASS__ ) {
|
142 |
+
if ( ! $field_info ) {
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
|
146 |
+
add_settings_field(
|
147 |
+
$field_info['id'], // ID
|
148 |
+
$field_info['title'], // Title
|
149 |
+
array( $class, 'field_callback_' . $field_info['id'] ), // Callback
|
150 |
+
PT_CV_DOMAIN, // Page
|
151 |
+
$section // Section
|
152 |
+
);
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* License key field
|
157 |
+
*/
|
158 |
+
public static function field_callback_unload_bootstrap() {
|
159 |
+
$field_name = 'unload_bootstrap';
|
160 |
+
|
161 |
+
self::_field_print( $field_name, 'checkbox', __( "Don't load Bootstrap style & script in frontend of website", PT_CV_DOMAIN ) );
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Print text/password field
|
166 |
+
*
|
167 |
+
* @param string $field_name The ID of field
|
168 |
+
* @param string $field_type The type of field
|
169 |
+
* @param string $desc Description text
|
170 |
+
*/
|
171 |
+
static function _field_print( $field_name, $field_type = 'text', $desc = '' ) {
|
172 |
+
|
173 |
+
// Get Saved value
|
174 |
+
$field_value = isset( self::$options[$field_name] ) ? esc_attr( self::$options[$field_name] ) : '';
|
175 |
+
$checked = '';
|
176 |
+
|
177 |
+
if ( in_array( $field_type, array( 'checkbox', 'radio' ) ) ) {
|
178 |
+
$checked = checked( 1, $field_value, false );
|
179 |
+
// Reassign value for this option
|
180 |
+
$field_value = 1;
|
181 |
+
}
|
182 |
+
|
183 |
+
$field_id = esc_attr( $field_name );
|
184 |
+
|
185 |
+
printf(
|
186 |
+
'<input type="%1$s" id="%2$s" name="%3$s[%2$s]" value="%4$s" %5$s /> ',
|
187 |
+
esc_attr( $field_type ), $field_id, PT_CV_OPTION_NAME, $field_value, $checked
|
188 |
+
);
|
189 |
+
|
190 |
+
if ( !empty( $desc)){
|
191 |
+
printf( '<label for="%s" class="label-for-option">%s</label>', $field_id, $desc );
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Print the text for Common setting Section
|
197 |
+
*/
|
198 |
+
public static function section_callback_setting_unload_bootstrap() {
|
199 |
+
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
}
|
admin/includes/templates/settings-section-one.php
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<p><br>Thank you for using Content Views!</p>
|
2 |
+
<p>You are using <strong>Free</strong> version: <?php echo PT_CV_Functions::plugin_info( PT_CV_FILE, 'Version' ); ?></p>
|
admin/includes/templates/settings-section-two.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<hr>
|
2 |
+
<p>Here is list of some of awesome features which are available at <a href="http://www.contentviewspro.com/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank">Content Views PRO</a></p>
|
3 |
+
|
4 |
+
<p>
|
5 |
+
<a href="http://www.contentviewspro.com/pricing/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank" class="btn btn-success btn-sm">Upgrade now</a>
|
6 |
+
</p>
|
7 |
+
|
8 |
+
<div class="row">
|
9 |
+
<div class="col-md-6">
|
10 |
+
<h3>
|
11 |
+
Query custom post types
|
12 |
+
</h3>
|
13 |
+
<div>
|
14 |
+
<p>You can get any posts of any custom post types (<strong>WooCommerce</strong> product, FAQ, Book...)</p>
|
15 |
+
<p>Especially, with <strong>WooCommerce</strong>, there are quick filters to pick up</p>
|
16 |
+
<ul style="list-style: circle; margin-left: 20px;">
|
17 |
+
<li>Recent products</li>
|
18 |
+
<li>Best selling products</li>
|
19 |
+
<li>Features products</li>
|
20 |
+
<li>Top rated products</li>
|
21 |
+
</ul>
|
22 |
+
easily
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
<div class="col-md-6">
|
26 |
+
<div>
|
27 |
+
<img src="<?php echo plugins_url('admin/assets/images/features/woocommerce.png', PT_CV_FILE); ?>" />
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
|
32 |
+
<hr>
|
33 |
+
|
34 |
+
<div class="row">
|
35 |
+
<div class="col-md-12">
|
36 |
+
<h3>
|
37 |
+
More beautiful & awesome layouts
|
38 |
+
</h3>
|
39 |
+
<div>
|
40 |
+
<div class="row">
|
41 |
+
<div class="col-md-6">
|
42 |
+
<h6>Scrollable list</h6>
|
43 |
+
<div>
|
44 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/scrollable.png', PT_CV_FILE); ?>" />
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
<div class="col-md-6">
|
48 |
+
<h6>Collapsible list</h6>
|
49 |
+
<div>
|
50 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/collapsible.png', PT_CV_FILE); ?>" />
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
<div class="row">
|
55 |
+
<div class="col-md-6">
|
56 |
+
<h6>Pinterest</h6>
|
57 |
+
<div>
|
58 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/pinterest.png', PT_CV_FILE); ?>" />
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
<div class="col-md-6">
|
62 |
+
<h6>Timeline</h6>
|
63 |
+
<div>
|
64 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/timeline.png', PT_CV_FILE); ?>" />
|
65 |
+
</div>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<hr>
|
73 |
+
|
74 |
+
<div class="row">
|
75 |
+
<div class="col-md-6">
|
76 |
+
<h3>
|
77 |
+
Drag & drop to change display order of fields
|
78 |
+
</h3>
|
79 |
+
<div>
|
80 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/drag_drop.png', PT_CV_FILE); ?>" />
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
<div class="col-md-6">
|
84 |
+
<h3>
|
85 |
+
Read more settings
|
86 |
+
</h3>
|
87 |
+
<div>
|
88 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/readmore.png', PT_CV_FILE); ?>" />
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
<hr>
|
94 |
+
|
95 |
+
<div class="row">
|
96 |
+
<div class="col-md-6">
|
97 |
+
<h3>
|
98 |
+
Custom font settings
|
99 |
+
</h3>
|
100 |
+
<div>
|
101 |
+
<p>You can customize Font family (from top 50 most popular Google fonts), font style, font size for Title, Content, Meta fields easily</p>
|
102 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/font-settings.png', PT_CV_FILE); ?>" style="height: 210px;" />
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
<div class="col-md-6">
|
106 |
+
<h3>
|
107 |
+
And more powerful options
|
108 |
+
</h3>
|
109 |
+
<div>
|
110 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/pagination.png', PT_CV_FILE); ?>" />
|
111 |
+
<img class="thumbnail" src="<?php echo plugins_url('admin/assets/images/features/openin.png', PT_CV_FILE); ?>" />
|
112 |
+
<br> <span style="font-size: 30px;">...</span>
|
113 |
+
</div>
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
|
117 |
+
<hr>
|
118 |
+
|
119 |
+
<p>I hope you enjoy with Content Views!</p>
|
120 |
+
<p>Plugin developed by PT Guy (palaceofthemes@gmail.com)</p>
|
121 |
+
<p>Copyright © 2014</p>
|
admin/views/admin.php
CHANGED
@@ -16,131 +16,21 @@
|
|
16 |
|
17 |
<style>
|
18 |
.wrap * { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
|
19 |
-
.wrap .row {
|
20 |
.wrap p, .wrap form { font-size: 14px; }
|
21 |
.wrap h3 { font-size: 16px; font-weight: bold; color: #FF6A5A; }
|
22 |
.wrap h6 { font-size: 15px; font-weight: bold; }
|
23 |
-
.
|
|
|
24 |
</style>
|
25 |
|
26 |
<?php
|
27 |
|
28 |
-
ob_start();
|
29 |
-
?>
|
30 |
-
<p><br>Thank you for using Content Views!</p>
|
31 |
-
<p>You are using <strong>Free</strong> version: <?php echo PT_CV_Functions::plugin_info( PT_CV_FILE, 'Version' ); ?></p>
|
32 |
-
<p>Here is list of some of awesome features which are available at <a href="http://www.wordpressquery.com/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank">Wordpress Query</a>.</p>
|
33 |
-
|
34 |
-
<p>
|
35 |
-
<a href="http://www.wordpressquery.com/pricing/?utm_source=settings_page&utm_medium=link&utm_campaign=content-views" target="_blank" class="btn btn-success">Upgrade now</a>
|
36 |
-
</p>
|
37 |
-
|
38 |
-
<div class="row">
|
39 |
-
<div class="col-md-6">
|
40 |
-
<h3>
|
41 |
-
Query custom post types: Woocommerce products, FAQ...
|
42 |
-
</h3>
|
43 |
-
<div>
|
44 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/content-type.png', PT_CV_FILE ); ?>" />
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
<div class="col-md-6">
|
48 |
-
<h3>
|
49 |
-
Post type specific order by options
|
50 |
-
</h3>
|
51 |
-
<div>
|
52 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/orderby.png', PT_CV_FILE ); ?>" />
|
53 |
-
</div>
|
54 |
-
</div>
|
55 |
-
</div>
|
56 |
-
|
57 |
-
<div class="row">
|
58 |
-
<div class="col-md-12">
|
59 |
-
<h3>
|
60 |
-
More beautiful & awesome layouts
|
61 |
-
</h3>
|
62 |
-
<div>
|
63 |
-
<div class="row">
|
64 |
-
<div class="col-md-6">
|
65 |
-
<h6>Scrollable list</h6>
|
66 |
-
<div>
|
67 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/scrollable.png', PT_CV_FILE ); ?>" />
|
68 |
-
</div>
|
69 |
-
</div>
|
70 |
-
<div class="col-md-6">
|
71 |
-
<h6>Collapsible list</h6>
|
72 |
-
<div>
|
73 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/collapsible.png', PT_CV_FILE ); ?>" />
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
</div>
|
77 |
-
<div class="row">
|
78 |
-
<div class="col-md-6">
|
79 |
-
<h6>Pinterest</h6>
|
80 |
-
<div>
|
81 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/pinterest.png', PT_CV_FILE ); ?>" />
|
82 |
-
</div>
|
83 |
-
</div>
|
84 |
-
<div class="col-md-6">
|
85 |
-
<h6>Timeline</h6>
|
86 |
-
<div>
|
87 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/timeline.png', PT_CV_FILE ); ?>" />
|
88 |
-
</div>
|
89 |
-
</div>
|
90 |
-
</div>
|
91 |
-
</div>
|
92 |
-
</div>
|
93 |
-
</div>
|
94 |
-
|
95 |
-
<div class="row">
|
96 |
-
<div class="col-md-6">
|
97 |
-
<h3>
|
98 |
-
Drag & drop to change display order of fields
|
99 |
-
</h3>
|
100 |
-
<div>
|
101 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/drag_drop.png', PT_CV_FILE ); ?>" />
|
102 |
-
</div>
|
103 |
-
</div>
|
104 |
-
<div class="col-md-6">
|
105 |
-
<h3>
|
106 |
-
Read more settings
|
107 |
-
</h3>
|
108 |
-
<div>
|
109 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/readmore.png', PT_CV_FILE ); ?>" />
|
110 |
-
</div>
|
111 |
-
</div>
|
112 |
-
</div>
|
113 |
-
|
114 |
-
<div class="row">
|
115 |
-
<div class="col-md-6">
|
116 |
-
<h3>
|
117 |
-
Custom font settings
|
118 |
-
</h3>
|
119 |
-
<div>
|
120 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/font-settings.png', PT_CV_FILE ); ?>" />
|
121 |
-
</div>
|
122 |
-
</div>
|
123 |
-
<div class="col-md-6">
|
124 |
-
<h3>
|
125 |
-
And more powerful options
|
126 |
-
</h3>
|
127 |
-
<div>
|
128 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/pagination.png', PT_CV_FILE ); ?>" />
|
129 |
-
<img class="thumbnail" src="<?php echo plugins_url( 'admin/assets/images/features/openin.png', PT_CV_FILE ); ?>" />
|
130 |
-
<br> <span style="font-size: 30px;">...</span>
|
131 |
-
</div>
|
132 |
-
</div>
|
133 |
-
</div>
|
134 |
-
|
135 |
-
<br>
|
136 |
-
<p>Enjoy with Content Views!</p>
|
137 |
-
<p>Plugin developed by PT guy (palaceofthemes@gmail.com)</p>
|
138 |
-
<p>Copyright © 2014</p>
|
139 |
-
<?php
|
140 |
-
$text = ob_get_clean();
|
141 |
|
142 |
-
|
|
|
|
|
143 |
|
144 |
-
|
145 |
?>
|
146 |
</div>
|
16 |
|
17 |
<style>
|
18 |
.wrap * { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
|
19 |
+
.wrap > .row { padding-bottom: 20px; }
|
20 |
.wrap p, .wrap form { font-size: 14px; }
|
21 |
.wrap h3 { font-size: 16px; font-weight: bold; color: #FF6A5A; }
|
22 |
.wrap h6 { font-size: 15px; font-weight: bold; }
|
23 |
+
.wrap img { max-width: 100%; }
|
24 |
+
.wrap .label-for-option { font-weight: normal; margin: auto; margin-bottom: -5px; margin-left: 4px; }
|
25 |
</style>
|
26 |
|
27 |
<?php
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
PT_CV_Plugin::settings_page_section_one();
|
31 |
+
// Settings form
|
32 |
+
PT_CV_Plugin::settings_page_form();
|
33 |
|
34 |
+
PT_CV_Plugin::settings_page_section_two();
|
35 |
?>
|
36 |
</div>
|
admin/views/view.php
CHANGED
@@ -82,9 +82,12 @@ if ( $id ) {
|
|
82 |
// Add nonce field
|
83 |
wp_nonce_field( PT_CV_PREFIX_ . 'view_submit', PT_CV_PREFIX_ . 'form_nonce' );
|
84 |
|
|
|
|
|
|
|
85 |
?>
|
86 |
<!-- add hidden field -->
|
87 |
-
<input type="hidden" name="<?php echo esc_attr( PT_CV_PREFIX . 'post-id' ); ?>" value="<?php echo esc_attr(
|
88 |
<input type="hidden" name="<?php echo esc_attr( PT_CV_PREFIX . 'view-id' ); ?>" value="<?php echo esc_attr( $id ); ?>" />
|
89 |
|
90 |
<?php
|
@@ -98,7 +101,7 @@ $options = array(
|
|
98 |
array(
|
99 |
'type' => 'text',
|
100 |
'name' => 'view-title',
|
101 |
-
'std' => '',
|
102 |
'desc' => __( 'Enter a name to identify your views easily', PT_CV_DOMAIN ),
|
103 |
),
|
104 |
),
|
@@ -141,6 +144,8 @@ $options = array(
|
|
141 |
),
|
142 |
),
|
143 |
|
|
|
|
|
144 |
// Common Filters
|
145 |
array(
|
146 |
'label' => array(
|
@@ -218,7 +223,7 @@ $options = array(
|
|
218 |
),
|
219 |
),
|
220 |
|
221 |
-
apply_filters( PT_CV_PREFIX_ . '
|
222 |
),
|
223 |
),
|
224 |
),
|
82 |
// Add nonce field
|
83 |
wp_nonce_field( PT_CV_PREFIX_ . 'view_submit', PT_CV_PREFIX_ . 'form_nonce' );
|
84 |
|
85 |
+
// Get post ID of this View
|
86 |
+
$post_id = PT_CV_Functions::post_id_from_meta_id( $id );
|
87 |
+
$view_object = $post_id ? get_post( $post_id ) : null;
|
88 |
?>
|
89 |
<!-- add hidden field -->
|
90 |
+
<input type="hidden" name="<?php echo esc_attr( PT_CV_PREFIX . 'post-id' ); ?>" value="<?php echo esc_attr( $post_id ); ?>" />
|
91 |
<input type="hidden" name="<?php echo esc_attr( PT_CV_PREFIX . 'view-id' ); ?>" value="<?php echo esc_attr( $id ); ?>" />
|
92 |
|
93 |
<?php
|
101 |
array(
|
102 |
'type' => 'text',
|
103 |
'name' => 'view-title',
|
104 |
+
'std' => isset( $view_object->post_title ) ? $view_object->post_title : '',
|
105 |
'desc' => __( 'Enter a name to identify your views easily', PT_CV_DOMAIN ),
|
106 |
),
|
107 |
),
|
144 |
),
|
145 |
),
|
146 |
|
147 |
+
apply_filters( PT_CV_PREFIX_ . 'custom_filters', array() ),
|
148 |
+
|
149 |
// Common Filters
|
150 |
array(
|
151 |
'label' => array(
|
223 |
),
|
224 |
),
|
225 |
|
226 |
+
apply_filters( PT_CV_PREFIX_ . 'after_limit_option', array() ),
|
227 |
),
|
228 |
),
|
229 |
),
|
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.1.
|
14 |
* Author: Palace Of Themes
|
15 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
16 |
* Text Domain: content-views
|
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
27 |
/*
|
28 |
* Define Constant
|
29 |
*/
|
30 |
-
define( 'PT_CV_VERSION', '1.1.
|
31 |
define( 'PT_CV_FILE', __FILE__ );
|
32 |
include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
|
33 |
|
@@ -76,6 +76,9 @@ if ( is_admin() ) {
|
|
76 |
|
77 |
// Require PT Options framework
|
78 |
include_once( plugin_dir_path( __FILE__ ) . 'admin/includes/options.php' );
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
/**
|
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.1.3
|
14 |
* Author: Palace Of Themes
|
15 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
16 |
* Text Domain: content-views
|
27 |
/*
|
28 |
* Define Constant
|
29 |
*/
|
30 |
+
define( 'PT_CV_VERSION', '1.1.3' );
|
31 |
define( 'PT_CV_FILE', __FILE__ );
|
32 |
include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
|
33 |
|
76 |
|
77 |
// Require PT Options framework
|
78 |
include_once( plugin_dir_path( __FILE__ ) . 'admin/includes/options.php' );
|
79 |
+
|
80 |
+
// Settings page for the plugin
|
81 |
+
include_once( plugin_dir_path( __FILE__ ) . 'admin/includes/plugin.php' );
|
82 |
}
|
83 |
|
84 |
/**
|
includes/functions.php
CHANGED
@@ -291,7 +291,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
|
|
291 |
}
|
292 |
|
293 |
/**
|
294 |
-
* Insert
|
295 |
*
|
296 |
* @param string $arr Array of post data
|
297 |
*/
|
@@ -316,6 +316,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
|
|
316 |
* Get View id in post table, from "id" meta key value
|
317 |
*
|
318 |
* @param string $meta_id ID of custom field
|
|
|
319 |
*/
|
320 |
static function post_id_from_meta_id( $meta_id ) {
|
321 |
|
@@ -487,8 +488,14 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
|
|
487 |
$content_items = array();
|
488 |
|
489 |
// The Query
|
|
|
|
|
|
|
|
|
490 |
$pt_query = new WP_Query( $args );
|
491 |
|
|
|
|
|
492 |
// The Loop
|
493 |
if ( $pt_query->have_posts() ) {
|
494 |
while ( $pt_query->have_posts() ) {
|
@@ -873,8 +880,12 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
|
|
873 |
// Current post id ( 0 if new view )
|
874 |
$cur_post_id = esc_sql( $_POST[PT_CV_PREFIX . 'post-id'] );
|
875 |
|
876 |
-
// Insert
|
877 |
-
|
|
|
|
|
|
|
|
|
878 |
|
879 |
/**
|
880 |
* ADD/UPDATE CUSTOM FIELDS
|
@@ -885,6 +896,11 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
|
|
885 |
update_post_meta( $post_id, PT_CV_META_ID, $view_id );
|
886 |
update_post_meta( $post_id, PT_CV_META_SETTINGS, (array) $_POST );
|
887 |
|
|
|
|
|
|
|
|
|
|
|
888 |
/**
|
889 |
* redirect to edit page
|
890 |
*/
|
291 |
}
|
292 |
|
293 |
/**
|
294 |
+
* Insert/Update post
|
295 |
*
|
296 |
* @param string $arr Array of post data
|
297 |
*/
|
316 |
* Get View id in post table, from "id" meta key value
|
317 |
*
|
318 |
* @param string $meta_id ID of custom field
|
319 |
+
* @return int Return Post ID of this view
|
320 |
*/
|
321 |
static function post_id_from_meta_id( $meta_id ) {
|
322 |
|
488 |
$content_items = array();
|
489 |
|
490 |
// The Query
|
491 |
+
$args = apply_filters( PT_CV_PREFIX_ . 'query_parameters', $args, $settings_ );
|
492 |
+
|
493 |
+
do_action( PT_CV_PREFIX_ . 'before_query', $settings_ );
|
494 |
+
|
495 |
$pt_query = new WP_Query( $args );
|
496 |
|
497 |
+
do_action( PT_CV_PREFIX_ . 'after_query', $settings_ );
|
498 |
+
|
499 |
// The Loop
|
500 |
if ( $pt_query->have_posts() ) {
|
501 |
while ( $pt_query->have_posts() ) {
|
880 |
// Current post id ( 0 if new view )
|
881 |
$cur_post_id = esc_sql( $_POST[PT_CV_PREFIX . 'post-id'] );
|
882 |
|
883 |
+
// Insert post
|
884 |
+
if ( ! $cur_post_id ) {
|
885 |
+
$post_id = PT_CV_Functions::post_insert( array( 'ID' => $cur_post_id, 'title' => $title ) );
|
886 |
+
} else {
|
887 |
+
$post_id = $cur_post_id;
|
888 |
+
}
|
889 |
|
890 |
/**
|
891 |
* ADD/UPDATE CUSTOM FIELDS
|
896 |
update_post_meta( $post_id, PT_CV_META_ID, $view_id );
|
897 |
update_post_meta( $post_id, PT_CV_META_SETTINGS, (array) $_POST );
|
898 |
|
899 |
+
// Update post title
|
900 |
+
if ( strpos( $title,'[ID:' ) === false ) {
|
901 |
+
PT_CV_Functions::post_insert( array( 'ID' => $post_id, 'title' => sprintf( '%s [ID: %s]', $title, $view_id ) ) );
|
902 |
+
}
|
903 |
+
|
904 |
/**
|
905 |
* redirect to edit page
|
906 |
*/
|
includes/html-viewtype.php
CHANGED
@@ -140,7 +140,7 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
|
|
140 |
|
141 |
// Control html
|
142 |
$show_navigation = isset( $dargs['view-type-settings']['navigation'] ) ? $dargs['view-type-settings']['navigation'] : 'yes';
|
143 |
-
$scrollable_html[] = self::scrollable_control( ( $show_navigation == 'yes' ) ? 1 : 0, $wrapper_id );
|
144 |
|
145 |
// Get wrapper class scrollable
|
146 |
$scrollable_class = apply_filters( PT_CV_PREFIX_ . 'scrollable_class', 'carousel slide' );
|
@@ -233,13 +233,16 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
|
|
233 |
return '';
|
234 |
}
|
235 |
|
236 |
-
$
|
237 |
-
|
238 |
-
$
|
239 |
-
|
240 |
-
|
|
|
|
|
241 |
|
242 |
-
|
|
|
243 |
|
244 |
return $output;
|
245 |
}
|
@@ -249,21 +252,24 @@ if ( ! class_exists( 'PT_CV_Html_ViewType' ) ) {
|
|
249 |
*
|
250 |
* @param bool $show Whether or not to show this element
|
251 |
* @param string $wrapper_id The ID of wrapper of scrollable list
|
|
|
252 |
*/
|
253 |
-
static function scrollable_control( $show, $wrapper_id ) {
|
254 |
if ( ! $show ) {
|
255 |
return '';
|
256 |
}
|
257 |
-
|
258 |
-
$
|
259 |
-
|
260 |
-
<
|
261 |
-
|
262 |
-
|
263 |
-
<
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
|
|
267 |
|
268 |
return $output;
|
269 |
}
|
140 |
|
141 |
// Control html
|
142 |
$show_navigation = isset( $dargs['view-type-settings']['navigation'] ) ? $dargs['view-type-settings']['navigation'] : 'yes';
|
143 |
+
$scrollable_html[] = self::scrollable_control( ( $show_navigation == 'yes' ) ? 1 : 0, $wrapper_id, $count_slides );
|
144 |
|
145 |
// Get wrapper class scrollable
|
146 |
$scrollable_class = apply_filters( PT_CV_PREFIX_ . 'scrollable_class', 'carousel slide' );
|
233 |
return '';
|
234 |
}
|
235 |
|
236 |
+
$output = '';
|
237 |
+
if ( $count_slides > 1 ) {
|
238 |
+
$li = array();
|
239 |
+
for ( $index = 0; $index < $count_slides; $index ++ ) {
|
240 |
+
$class = ( $index == 0 ) ? 'active' : '';
|
241 |
+
$li[] = sprintf( '<li data-target="#%s" data-slide-to="%s" class="%s"></li>', esc_attr( $wrapper_id ), esc_attr( $index ), $class );
|
242 |
+
}
|
243 |
|
244 |
+
$output = '<ol class="carousel-indicators">' . implode( "\n", $li ) . '</ol>';
|
245 |
+
}
|
246 |
|
247 |
return $output;
|
248 |
}
|
252 |
*
|
253 |
* @param bool $show Whether or not to show this element
|
254 |
* @param string $wrapper_id The ID of wrapper of scrollable list
|
255 |
+
* @param int $count_slides The amount of items
|
256 |
*/
|
257 |
+
static function scrollable_control( $show, $wrapper_id, $count_slides ) {
|
258 |
if ( ! $show ) {
|
259 |
return '';
|
260 |
}
|
261 |
+
$output = '';
|
262 |
+
if ( $count_slides > 1 ) {
|
263 |
+
$output = sprintf(
|
264 |
+
'<a class="left carousel-control" href="#%1$s" data-slide="prev">
|
265 |
+
<span class="glyphicon glyphicon-chevron-left"></span>
|
266 |
+
</a>
|
267 |
+
<a class="right carousel-control" href="#%1$s" data-slide="next">
|
268 |
+
<span class="glyphicon glyphicon-chevron-right"></span>
|
269 |
+
</a>',
|
270 |
+
esc_attr( $wrapper_id )
|
271 |
+
);
|
272 |
+
}
|
273 |
|
274 |
return $output;
|
275 |
}
|
includes/html.php
CHANGED
@@ -433,6 +433,10 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
|
|
433 |
$html = self::_field_meta( $post, $fargs['meta-fields'], $dargs );
|
434 |
|
435 |
break;
|
|
|
|
|
|
|
|
|
436 |
}
|
437 |
|
438 |
return $html;
|
@@ -722,10 +726,17 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
|
|
722 |
|
723 |
/**
|
724 |
* Scripts for Preview & WP frontend
|
|
|
725 |
*/
|
726 |
-
static function frontend_scripts() {
|
727 |
-
|
728 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
|
730 |
// Load bootstrap paginator
|
731 |
PT_CV_Asset::enqueue( 'bootstrap-paginator' );
|
@@ -751,9 +762,18 @@ if ( ! class_exists( 'PT_CV_Html' ) ) {
|
|
751 |
|
752 |
/**
|
753 |
* Styles for Preview & WP frontend
|
|
|
|
|
|
|
754 |
*/
|
755 |
-
static function frontend_styles() {
|
756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
757 |
|
758 |
PT_CV_Asset::enqueue(
|
759 |
'public', 'style', array(
|
433 |
$html = self::_field_meta( $post, $fargs['meta-fields'], $dargs );
|
434 |
|
435 |
break;
|
436 |
+
|
437 |
+
default :
|
438 |
+
$html = apply_filters( PT_CV_PREFIX_ . 'field_item_html', $html, $field_name, $post );
|
439 |
+
break;
|
440 |
}
|
441 |
|
442 |
return $html;
|
726 |
|
727 |
/**
|
728 |
* Scripts for Preview & WP frontend
|
729 |
+
* @param bool $is_admin Whether or not in WP Admin
|
730 |
*/
|
731 |
+
static function frontend_scripts( $is_admin = false ) {
|
732 |
+
|
733 |
+
// Get settings option
|
734 |
+
$options = get_option( PT_CV_OPTION_NAME );
|
735 |
+
|
736 |
+
if ( $is_admin || ! isset( $options['unload_bootstrap'] ) ) {
|
737 |
+
// Load bootstrap js
|
738 |
+
PT_CV_Asset::enqueue( 'bootstrap' );
|
739 |
+
}
|
740 |
|
741 |
// Load bootstrap paginator
|
742 |
PT_CV_Asset::enqueue( 'bootstrap-paginator' );
|
762 |
|
763 |
/**
|
764 |
* Styles for Preview & WP frontend
|
765 |
+
*
|
766 |
+
* @global bool $is_IE
|
767 |
+
* @param bool $is_admin Whether or not in WP Admin
|
768 |
*/
|
769 |
+
static function frontend_styles( $is_admin = false ) {
|
770 |
+
|
771 |
+
// Get settings option
|
772 |
+
$options = get_option( PT_CV_OPTION_NAME );
|
773 |
+
|
774 |
+
if ( $is_admin || ! isset( $options['unload_bootstrap'] ) ) {
|
775 |
+
PT_CV_Asset::enqueue( 'bootstrap', 'style' );
|
776 |
+
}
|
777 |
|
778 |
PT_CV_Asset::enqueue(
|
779 |
'public', 'style', array(
|
includes/settings.php
CHANGED
@@ -205,7 +205,7 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
|
|
205 |
'name' => $prefix . 'open-in',
|
206 |
'options' => PT_CV_Values::open_in(),
|
207 |
'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::open_in() ),
|
208 |
-
'desc' => __( 'How to open an item when click on Title
|
209 |
),
|
210 |
),
|
211 |
),
|
@@ -459,6 +459,8 @@ if ( ! class_exists( 'PT_CV_Settings' ) ) {
|
|
459 |
),
|
460 |
),
|
461 |
|
|
|
|
|
462 |
// Show Content
|
463 |
array(
|
464 |
'label' => array(
|
205 |
'name' => $prefix . 'open-in',
|
206 |
'options' => PT_CV_Values::open_in(),
|
207 |
'std' => PT_CV_Functions::array_get_first_key( PT_CV_Values::open_in() ),
|
208 |
+
'desc' => __( 'How to open an item when click on Title or Thumbnail', PT_CV_DOMAIN ),
|
209 |
),
|
210 |
),
|
211 |
),
|
459 |
),
|
460 |
),
|
461 |
|
462 |
+
apply_filters( PT_CV_PREFIX_ . 'field_display_option', array(), $prefix ),
|
463 |
+
|
464 |
// Show Content
|
465 |
array(
|
466 |
'label' => array(
|
public/assets/css/public.css
CHANGED
@@ -135,7 +135,7 @@
|
|
135 |
text-align: left;
|
136 |
left: 0;
|
137 |
right: 15px;
|
138 |
-
bottom:
|
139 |
}
|
140 |
|
141 |
.pt-cv-view .carousel-caption * {
|
@@ -148,6 +148,8 @@
|
|
148 |
text-shadow: 0px 1px 1px #000;
|
149 |
left: 15px !important;
|
150 |
padding-left: 10px;
|
|
|
|
|
151 |
}
|
152 |
|
153 |
.pt-cv-cap-w-img * {
|
135 |
text-align: left;
|
136 |
left: 0;
|
137 |
right: 15px;
|
138 |
+
bottom: 14px;
|
139 |
}
|
140 |
|
141 |
.pt-cv-view .carousel-caption * {
|
148 |
text-shadow: 0px 1px 1px #000;
|
149 |
left: 15px !important;
|
150 |
padding-left: 10px;
|
151 |
+
padding-bottom: 0;
|
152 |
+
padding-top: 10px;
|
153 |
}
|
154 |
|
155 |
.pt-cv-cap-w-img * {
|
public/templates/scrollable/html/main.php
CHANGED
@@ -13,7 +13,8 @@ $html = array();
|
|
13 |
|
14 |
$ex_cap_cls = PT_CV_PREFIX . 'cap-w-img';;
|
15 |
|
16 |
-
|
|
|
17 |
// Thumbnail html
|
18 |
$html[] = $fields_html['thumbnail'];
|
19 |
unset( $fields_html['thumbnail'] );
|
13 |
|
14 |
$ex_cap_cls = PT_CV_PREFIX . 'cap-w-img';;
|
15 |
|
16 |
+
$img = strip_tags( isset( $fields_html['thumbnail'] ) ? $fields_html['thumbnail'] : '', '<img>' );
|
17 |
+
if ( ! empty( $img ) ) {
|
18 |
// Thumbnail html
|
19 |
$html[] = $fields_html['thumbnail'];
|
20 |
unset( $fields_html['thumbnail'] );
|