Need support for Pages and Custom Post Types (CPTs)
-
Great idea, and works well for Posts, but we need it to work for Pages and Custom Post Types.
Any plans to support these other post types, please?
-
GPT-4 Code Interpreter is suggesting this patch:
/src/Post/Admin/PostList.php
<?php namespace PostDraftPreview\Post\Admin; use PostDraftPreview\Post\Post; class PostList { private ?Post $post = null; public function __construct(Post $post) { $this->post = $post; // Get all public post types $public_post_types = get_post_types(array('public' => true)); // Add a filter for each public post type foreach ($public_post_types as $post_type) { add_filter("{$post_type}_row_actions", [$this, 'postRowActionsLink'], 10, 2); } } /** @filter post_row_actions 10 2 */ public function postRowActionsLink(array $actions, \WP_Post $post): array { if (! $this->post->getMeta()->getStatus($post->ID)) { return $actions; } if (in_array(get_post_status($post), array('draft', 'pending', 'auto-draft'))) { $actions[] = '<a href="' . $this->post->getDraft()->getPublicDraftPreviewUrl($post) . '" target="_blank">' . __('Public draft preview', 'pdp') . '</a>'; } return $actions; } }
It works to enable for Pages (by removing the hierarchy criteria, but for some reason still isn’t showing for an ACF created Custom Post Type in the Publish metabox.
So close! Be very happy if you can solve this!
Dear @surferking,
Thank you for your brilliant suggestion! We love seeing our users actively involved in enhancing our plugin.
Your request to extend the plugin’s functionality to Pages and Custom Post Types, including those created with ACF, has been noted. We have added your suggestion to our development roadmap.
Stay tuned! We’re excited about this and promise to keep you updated as we make strides in this direction. Thanks again for your input.
Brilliant. I got the above from using the new GPT-4 Code Interpreter beta. Mind-blowing times! Looking forward to the update 🙂
I see in the latest update PDP now works for Pages, as well as Posts. Thanks for that!
Any luck with Custom Post Types using the classic Publish Metabox?
I have an ACF CPT that I need to share Preview links for landing pages before publishing. We have no other workaround than countless screenshots and emails.
@surferking We’d like to inform you that we have released an update and conducted additional tests. The PDP option should be available for all post types, whether they use the classic interface or the Gutenberg interface
Brilliant – thank you! I ran the update from 2 weeks ago, so I guess if it is a more recent update, it’s taking some time for wordpress.org to release it. Will test as soon as I see it come through. 🤞
@surferking Actually, the update from two weeks ago should work 🙂
Thanks. I just checked again, and I’m not seeing it. For this CPT, we have disabled the Gutenberg editor, so I was expecting to see it in the Publish metabox for a Draft, but unfortunately not. Same for the list view for the CPT. I’m not seeing a guest link on hovering over each CPT Title. Using ACF to create the CPT if you’re trying to reproduce. Hope that helps.
Hi @surferking
We have carefully checked this issue and we were not able to replicate it in our test environment, also while creating CPT via ACF. It seems your problem may be related to your specific setup (i.e. conflicting plugins or custom code).
As this is a free plugin, our resources are very limited, and we are unable to dedicate more time to solving your problem.
If you find a solution just let us know, and we will update the plugin. Thank you for your understanding.
- The topic ‘Need support for Pages and Custom Post Types (CPTs)’ is closed to new replies.