Version Description
Download this release
Release Info
Developer | vanderwijk |
Plugin | Content Blocks (Custom Post Widget) |
Version | 2.7.3 |
Comparing to | |
See all releases |
Code changes from version 2.7.2 to 2.7.3
- custom-post-widget.php +1 -1
- popup.php +3 -2
- readme.txt +11 -0
custom-post-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Savvii Custom Post Widget
|
4 |
Plugin URI: https://www.savvii.eu/wordpress-custom-post-widget/
|
5 |
Description: Show the content of a custom post of the type 'content_block' in a widget or with a shortcode.
|
6 |
-
Version: 2.7.
|
7 |
Author: Savvii WordPress Hosting
|
8 |
Author URI: https://www.savvii.eu/
|
9 |
License: GPL2
|
3 |
Plugin Name: Savvii Custom Post Widget
|
4 |
Plugin URI: https://www.savvii.eu/wordpress-custom-post-widget/
|
5 |
Description: Show the content of a custom post of the type 'content_block' in a widget or with a shortcode.
|
6 |
+
Version: 2.7.3
|
7 |
Author: Savvii WordPress Hosting
|
8 |
Author URI: https://www.savvii.eu/
|
9 |
License: GPL2
|
popup.php
CHANGED
@@ -24,6 +24,7 @@ function add_content_block_popup() { ?>
|
|
24 |
<script>
|
25 |
function selectContentBlockId(select) {
|
26 |
content_id = select.options[select.selectedIndex].value;
|
|
|
27 |
}
|
28 |
function insertContentBlockShortcode() {
|
29 |
if (typeof content_id === 'undefined') {
|
@@ -31,7 +32,7 @@ function add_content_block_popup() { ?>
|
|
31 |
return false;
|
32 |
}
|
33 |
var win = window.dialogArguments || opener || parent || top;
|
34 |
-
win.send_to_editor( "[content_block id=" + content_id + "]" );
|
35 |
}
|
36 |
</script>
|
37 |
<div id="content-block-form" style="display: none;">
|
@@ -51,7 +52,7 @@ function add_content_block_popup() { ?>
|
|
51 |
$content_block = get_posts( $args );
|
52 |
if ($content_block) {
|
53 |
foreach( $content_block as $content_block ) : setup_postdata( $content_block );
|
54 |
-
echo '<option value="' . $content_block->ID . '">' . $content_block->post_title . '</option>';
|
55 |
endforeach;
|
56 |
} else {
|
57 |
echo '<option value="">' . __( 'No content blocks available', 'custom-post-widget' ) . '</option>';
|
24 |
<script>
|
25 |
function selectContentBlockId(select) {
|
26 |
content_id = select.options[select.selectedIndex].value;
|
27 |
+
content_slug = select.options[select.selectedIndex].getAttribute("data-slug");
|
28 |
}
|
29 |
function insertContentBlockShortcode() {
|
30 |
if (typeof content_id === 'undefined') {
|
32 |
return false;
|
33 |
}
|
34 |
var win = window.dialogArguments || opener || parent || top;
|
35 |
+
win.send_to_editor( "[content_block id=" + content_id + " slug=" + content_slug + "]" );
|
36 |
}
|
37 |
</script>
|
38 |
<div id="content-block-form" style="display: none;">
|
52 |
$content_block = get_posts( $args );
|
53 |
if ($content_block) {
|
54 |
foreach( $content_block as $content_block ) : setup_postdata( $content_block );
|
55 |
+
echo '<option value="' . $content_block->ID . '" data-slug="' . $content_block->post_name . '">' . $content_block->post_title . '</option>';
|
56 |
endforeach;
|
57 |
} else {
|
58 |
echo '<option value="">' . __( 'No content blocks available', 'custom-post-widget' ) . '</option>';
|
readme.txt
CHANGED
@@ -82,6 +82,17 @@ Currently the shortcode function only outputs the post content of the content bl
|
|
82 |
|
83 |
You can create your own widget template and upload this to your theme folder. See [this support topic](http://wordpress.org/support/topic/patch-custom-widget-frontends?replies=1) for more information about this feature.
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
= Post ID's confuse me, can I use the post slug for embedding a content block? =
|
86 |
|
87 |
Yes, v2.6 now gives you the option to use the content block's url slug in the shortcode. Use the following syntax for doing this: `[content_block slug=my-content-block]`.
|
82 |
|
83 |
You can create your own widget template and upload this to your theme folder. See [this support topic](http://wordpress.org/support/topic/patch-custom-widget-frontends?replies=1) for more information about this feature.
|
84 |
|
85 |
+
= Can I make the post type public? =
|
86 |
+
|
87 |
+
You can make the post type public by adding the following code to your theme's functions.php file:
|
88 |
+
`function filter_content_block_init() {
|
89 |
+
$content_block_public = true;
|
90 |
+
return $content_block_public;
|
91 |
+
}
|
92 |
+
add_filter('content_block_post_type','filter_content_block_init');`
|
93 |
+
|
94 |
+
Alternatively you can use [this third-party plugin](http://demomentsomtres.com/english/wordpress-plugins/demomentsomtres-wpbakery-visual-composer-custom-post-widget/).
|
95 |
+
|
96 |
= Post ID's confuse me, can I use the post slug for embedding a content block? =
|
97 |
|
98 |
Yes, v2.6 now gives you the option to use the content block's url slug in the shortcode. Use the following syntax for doing this: `[content_block slug=my-content-block]`.
|