PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
convertkit / admin / class-convertkit-admin-landing-page.php

class-convertkit-admin-landing-page.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 3.4.3, at admin/class-convertkit-admin-landing-page.php

79 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ConvertKit Admin Landing Page class.
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 /**
10 * Modifies the Pages WP_List_Table to provide:
11 * - an 'Add New Landing Page' button next to the 'Add New' button
12 *
13 * @package ConvertKit
14 * @author ConvertKit
15 */
16 class ConvertKit_Admin_Landing_Page {
17
18 /**
19 * Registers action and filter hooks.
20 *
21 * @since 2.5.5
22 */
23 public function __construct() {
24
25 // Add New Landing Page Wizard button to Pages.
26 add_filter( 'convertkit_admin_post_register_add_new_buttons', array( $this, 'register_add_new_button' ), 10, 2 );
27
28 }
29
30 /**
31 * Registers a button in the Pages WP_List_Table linking to the the Landing Page Setup Wizard.
32 *
33 * @since 2.5.5
34 *
35 * @param array $buttons Buttons.
36 * @param string $post_type Post Type.
37 * @return array Views
38 */
39 public function register_add_new_button( $buttons, $post_type ) {
40
41 // If no API credentials have been set, don't output the button.
42 $settings = new ConvertKit_Settings();
43 if ( ! $settings->has_access_and_refresh_token() ) {
44 return $buttons;
45 }
46
47 // If the Add New Landing Page / Member Content button is disabled, don't output the button.
48 if ( $settings->add_new_button_disabled() ) {
49 return $buttons;
50 }
51
52 // Bail if the Post Type isn't supported.
53 if ( $post_type !== 'page' ) {
54 return $buttons;
55 }
56
57 // Don't show the button if the user cannot create and publish Pages.
58 if ( ! convertkit_user_can_create_published_post_type( $post_type ) ) {
59 return $buttons;
60 }
61
62 // Register button.
63 $buttons['convertkit_landing_page_setup'] = array(
64 'url' => add_query_arg(
65 array(
66 'page' => 'convertkit-landing-page-setup',
67 'ck_post_type' => $post_type,
68 ),
69 admin_url( 'options.php' )
70 ),
71 'label' => __( 'Landing Page', 'convertkit' ),
72 );
73
74 return $buttons;
75
76 }
77
78 }
79