Page Links To - Version 3.2.2

Version Description

  • Bug fixes
  • Better compat with custom post types in the Block Editor
Download this release

Release Info

Developer markjaquith
Plugin Icon wp plugin Page Links To
Version 3.2.2
Comparing to
See all releases

Code changes from version 3.2.1 to 3.2.2

Files changed (3) hide show
  1. classes/plugin.php +24 -3
  2. page-links-to.php +1 -1
  3. readme.txt +6 -2
classes/plugin.php CHANGED
@@ -31,7 +31,7 @@ class CWS_PageLinksTo {
31
const DISMISSED_NOTICES = 'page_links_dismissed_options';
32
const MESSAGE_ID = 4;
33
const NEWSLETTER_URL = 'https://pages.convertkit.com/8eb23c1339/1ce4614706';
34
- const CSS_JS_VERSION = '3.2.1';
35
36
/**
37
* Whether to replace WP links with their specified URLs.
@@ -174,6 +174,8 @@ class CWS_PageLinksTo {
174
$this->hook( 'enqueue_block_editor_assets' );
175
$this->hook( 'admin_menu' );
176
177
// Gutenberg.
178
$this->hook( 'use_block_editor_for_post', 99999 );
179
@@ -216,6 +218,21 @@ class CWS_PageLinksTo {
216
return $use_block_editor;
217
}
218
219
/**
220
* Registers a post meta key for a given post type.
221
*
@@ -708,8 +725,11 @@ class CWS_PageLinksTo {
708
if ( ! is_singular() || ! get_queried_object_id() ) {
709
return false;
710
}
711
712
- $link = self::absolute_url( self::get_link( get_queried_object_id() ) );
713
714
return $link;
715
}
@@ -1032,9 +1052,10 @@ class CWS_PageLinksTo {
1032
* @return array The modified post states array.
1033
*/
1034
public function display_post_states( $states, $post ) {
1035
- $link = $this->absolute_url( self::get_link( $post ) );
1036
1037
if ( $link ) {
1038
$output = '';
1039
$output_parts = array(
1040
'custom' => '<a title="' . __( 'Linked URL', 'page-links-to' ) . '" href="' . esc_url( $link ) . '" class="plt-post-state-link"><span class="dashicons dashicons-admin-links"></span><span class="url"> ' . esc_url( $link ) . '</span></a>',
31
const DISMISSED_NOTICES = 'page_links_dismissed_options';
32
const MESSAGE_ID = 4;
33
const NEWSLETTER_URL = 'https://pages.convertkit.com/8eb23c1339/1ce4614706';
34
+ const CSS_JS_VERSION = '3.2.2';
35
36
/**
37
* Whether to replace WP links with their specified URLs.
174
$this->hook( 'enqueue_block_editor_assets' );
175
$this->hook( 'admin_menu' );
176
177
+ $this->hook( 'rest_api_init' );
178
+
179
// Gutenberg.
180
$this->hook( 'use_block_editor_for_post', 99999 );
181
218
return $use_block_editor;
219
}
220
221
+ /**
222
+ * Adds custom-fields support to PLT-supporting post types during REST API initialization.
223
+ *
224
+ * @return void
225
+ */
226
+ function rest_api_init() {
227
+ $post_type_names = array_keys( get_post_types() );
228
+
229
+ foreach ( $post_type_names as $type ) {
230
+ if ( self::is_supported_post_type( $type ) ) {
231
+ add_post_type_support( $type, 'custom-fields' );
232
+ }
233
+ }
234
+ }
235
+
236
/**
237
* Registers a post meta key for a given post type.
238
*
725
if ( ! is_singular() || ! get_queried_object_id() ) {
726
return false;
727
}
728
+ $link = self::get_link( get_queried_object_id() );
729
730
+ if ( $link ) {
731
+ $link = self::absolute_url( $link );
732
+ }
733
734
return $link;
735
}
1052
* @return array The modified post states array.
1053
*/
1054
public function display_post_states( $states, $post ) {
1055
+ $link = self::get_link( $post );
1056
1057
if ( $link ) {
1058
+ $link = $this->absolute_url( $link );
1059
$output = '';
1060
$output_parts = array(
1061
'custom' => '<a title="' . __( 'Linked URL', 'page-links-to' ) . '" href="' . esc_url( $link ) . '" class="plt-post-state-link"><span class="dashicons dashicons-admin-links"></span><span class="url"> ' . esc_url( $link ) . '</span></a>',
page-links-to.php CHANGED
@@ -7,7 +7,7 @@
7
* Plugin Name: Page Links To
8
* Plugin URI: http://txfx.net/wordpress-plugins/page-links-to/
9
* Description: Allows you to point WordPress pages or posts to a URL of your choosing. Good for setting up navigational links to non-WP sections of your site or to off-site resources.
10
- * Version: 3.2.1
11
* Author: Mark Jaquith
12
* Author URI: https://coveredweb.com/
13
* Text Domain: page-links-to
7
* Plugin Name: Page Links To
8
* Plugin URI: http://txfx.net/wordpress-plugins/page-links-to/
9
* Description: Allows you to point WordPress pages or posts to a URL of your choosing. Good for setting up navigational links to non-WP sections of your site or to off-site resources.
10
+ * Version: 3.2.2
11
* Author: Mark Jaquith
12
* Author URI: https://coveredweb.com/
13
* Text Domain: page-links-to
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: markjaquith
4
Donate link: https://txfx.net/wordpress-plugins/donate
5
Tags: page, redirect, link, external link, repoint
6
Requires at least: 4.8
7
- Tested up to: 5.3
8
- Stable tag: 3.2.1
9
10
Lets you make a WordPress page (or port or other content type) link to a URL of your choosing (on your site, or on another site), instead of its normal WordPress URL.
11
@@ -77,6 +77,10 @@ You can contribute (or report bugs) on [Github](https://github.com/markjaquith/p
77
78
== Changelog ==
79
80
= 3.2.1 =
81
* Bug fixes
82
4
Donate link: https://txfx.net/wordpress-plugins/donate
5
Tags: page, redirect, link, external link, repoint
6
Requires at least: 4.8
7
+ Tested up to: 5.4
8
+ Stable tag: 3.2.2
9
10
Lets you make a WordPress page (or port or other content type) link to a URL of your choosing (on your site, or on another site), instead of its normal WordPress URL.
11
77
78
== Changelog ==
79
80
+ = 3.2.2 =
81
+ * Bug fixes
82
+ * Better compat with custom post types in the Block Editor
83
+
84
= 3.2.1 =
85
* Bug fixes
86