Version Description
- Add FAQ for creating a custom template. Details
- Parse
<!--nextpage-->
separators in Content and All displays on legacy insert mode. Details - Add support for custom templates for Insert Pages within Elementor and Beaver Builder. Details
Download this release
Release Info
Developer | figureone |
Plugin | Insert Pages |
Version | 3.5.2 |
Comparing to | |
See all releases |
Code changes from version 3.5.1 to 3.5.2
- insert-pages.php +11 -1
- readme.txt +28 -0
- widget.php +16 -0
insert-pages.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* Text Domain: insert-pages
|
8 |
* Domain Path: /languages
|
9 |
* License: GPL2
|
10 |
-
* Version: 3.5.
|
11 |
*
|
12 |
* @package insert-pages
|
13 |
*/
|
@@ -884,6 +884,11 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
|
|
884 |
} else {
|
885 |
echo get_the_content();
|
886 |
}
|
|
|
|
|
|
|
|
|
|
|
887 |
break;
|
888 |
case 'post-thumbnail':
|
889 |
?><a href="<?php echo esc_url( get_permalink( $inserted_page->ID ) ); ?>"><?php echo get_the_post_thumbnail( $inserted_page->ID ); ?></a>
|
@@ -901,6 +906,11 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
|
|
901 |
echo get_the_content();
|
902 |
}
|
903 |
the_meta();
|
|
|
|
|
|
|
|
|
|
|
904 |
break;
|
905 |
default: // Display is either invalid, or contains a template file to use.
|
906 |
$template = locate_template( $attributes['display'] );
|
7 |
* Text Domain: insert-pages
|
8 |
* Domain Path: /languages
|
9 |
* License: GPL2
|
10 |
+
* Version: 3.5.2
|
11 |
*
|
12 |
* @package insert-pages
|
13 |
*/
|
884 |
} else {
|
885 |
echo get_the_content();
|
886 |
}
|
887 |
+
// Render any <!--nextpage--> pagination links.
|
888 |
+
wp_link_pages( array(
|
889 |
+
'before' => '<div class="page-links">' . __( 'Pages:', 'twentynineteen' ),
|
890 |
+
'after' => '</div>',
|
891 |
+
) );
|
892 |
break;
|
893 |
case 'post-thumbnail':
|
894 |
?><a href="<?php echo esc_url( get_permalink( $inserted_page->ID ) ); ?>"><?php echo get_the_post_thumbnail( $inserted_page->ID ); ?></a>
|
906 |
echo get_the_content();
|
907 |
}
|
908 |
the_meta();
|
909 |
+
// Render any <!--nextpage--> pagination links.
|
910 |
+
wp_link_pages( array(
|
911 |
+
'before' => '<div class="page-links">' . __( 'Pages:', 'twentynineteen' ),
|
912 |
+
'after' => '</div>',
|
913 |
+
) );
|
914 |
break;
|
915 |
default: // Display is either invalid, or contains a template file to use.
|
916 |
$template = locate_template( $attributes['display'] );
|
readme.txt
CHANGED
@@ -48,6 +48,29 @@ The possibilities are endless!
|
|
48 |
|
49 |
== Frequently Asked Questions ==
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
= How do I limit the list of pages in the dialog to certain post types? =
|
52 |
|
53 |
You can hook into the 'insert_pages_available_post_types' filter to limit the post types displayed in the dialog. Here's an example filter that just shows Posts:
|
@@ -86,6 +109,11 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
|
|
86 |
|
87 |
== Changelog ==
|
88 |
|
|
|
|
|
|
|
|
|
|
|
89 |
= 3.5.1 =
|
90 |
* Fix Gutenberg block assets (js, css) loading on front end.
|
91 |
* Add option to disable Insert Pages Gutenberg block.
|
48 |
|
49 |
== Frequently Asked Questions ==
|
50 |
|
51 |
+
= How do I create a custom template for use by Insert Pages?
|
52 |
+
|
53 |
+
A basic template would look like the following. This would be a file on your theme directory, e.g., `your-custom-template.php`:
|
54 |
+
|
55 |
+
`<?php
|
56 |
+
/**
|
57 |
+
* Template Name: Name of your custom template
|
58 |
+
*/
|
59 |
+
?>
|
60 |
+
<div id="your-wrapper-div">
|
61 |
+
<?php while ( have_posts() ) : the_post(); ?>
|
62 |
+
<div id="your-container-div-for-each-post">
|
63 |
+
<?php the_content(); ?>
|
64 |
+
<?php the_post_thumbnail(); ?>
|
65 |
+
</div>
|
66 |
+
<?php endwhile; ?>
|
67 |
+
</div>`
|
68 |
+
|
69 |
+
You can use whatever template tags that you'd like, check out the WordPress documentation.
|
70 |
+
|
71 |
+
* https://developer.wordpress.org/themes/basics/template-tags/
|
72 |
+
* https://developer.wordpress.org/themes/references/list-of-template-tags/
|
73 |
+
|
74 |
= How do I limit the list of pages in the dialog to certain post types? =
|
75 |
|
76 |
You can hook into the 'insert_pages_available_post_types' filter to limit the post types displayed in the dialog. Here's an example filter that just shows Posts:
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 3.5.2 =
|
113 |
+
* Add FAQ for creating a custom template. [Details](https://wordpress.org/support/topic/suggestion-for-faq-documentation/)
|
114 |
+
* Parse `<!--nextpage-->` separators in Content and All displays on legacy insert mode. [Details](https://wordpress.org/support/topic/not-working-with-insert-page/)
|
115 |
+
* Add support for custom templates for Insert Pages within Elementor and Beaver Builder. [Details](https://wordpress.org/support/topic/use-a-custom-template-doesnt-show-custom-template-filename-in-builder/)
|
116 |
+
|
117 |
= 3.5.1 =
|
118 |
* Fix Gutenberg block assets (js, css) loading on front end.
|
119 |
* Add option to disable Insert Pages Gutenberg block.
|
widget.php
CHANGED
@@ -21,6 +21,10 @@ class InsertPagesWidget extends WP_Widget {
|
|
21 |
// Load admin javascript for Widget options on admin page (widgets.php).
|
22 |
add_action( 'sidebar_admin_page', array( $this, 'widget_admin_js' ) );
|
23 |
|
|
|
|
|
|
|
|
|
24 |
// Load admin javascript for Widget options on theme customize page (customize.php).
|
25 |
add_action( 'customize_controls_enqueue_scripts', array( $this, 'widget_admin_js' ) );
|
26 |
|
@@ -90,6 +94,18 @@ class InsertPagesWidget extends WP_Widget {
|
|
90 |
* @param array $instance The widget options.
|
91 |
*/
|
92 |
public function form( $instance ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
$instance = wp_parse_args( (array) $instance, array(
|
94 |
'page' => '',
|
95 |
'display' => 'link',
|
21 |
// Load admin javascript for Widget options on admin page (widgets.php).
|
22 |
add_action( 'sidebar_admin_page', array( $this, 'widget_admin_js' ) );
|
23 |
|
24 |
+
// Load widget javascript in supported builders (Beaver Builder, Elementor).
|
25 |
+
add_action( 'fl_builder_layout_style_dependencies', array( $this, 'widget_admin_js' ) );
|
26 |
+
add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'widget_admin_js' ) );
|
27 |
+
|
28 |
// Load admin javascript for Widget options on theme customize page (customize.php).
|
29 |
add_action( 'customize_controls_enqueue_scripts', array( $this, 'widget_admin_js' ) );
|
30 |
|
94 |
* @param array $instance The widget options.
|
95 |
*/
|
96 |
public function form( $instance ) {
|
97 |
+
|
98 |
+
// Beaver Builder loads the widget without some required wp-admin
|
99 |
+
// dependencies. Add them here.
|
100 |
+
if ( ! function_exists( 'page_template_dropdown' ) ) {
|
101 |
+
// For page_template_dropdown():
|
102 |
+
/** WordPress Template Administration API */
|
103 |
+
require_once( ABSPATH . 'wp-admin/includes/template.php' );
|
104 |
+
// For get_page_templates():
|
105 |
+
/** WordPress Theme Administration API */
|
106 |
+
require_once( ABSPATH . 'wp-admin/includes/theme.php' );
|
107 |
+
}
|
108 |
+
|
109 |
$instance = wp_parse_args( (array) $instance, array(
|
110 |
'page' => '',
|
111 |
'display' => 'link',
|