PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 All 503 releases
← All changes | modules/custom-content-types.php +102 -34 12.7.316.2 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 - * Module Name: Custom content types
3 + * Module Name: Custom Content Types
4 4 * Module Description: Display different types of content on your site with custom content types.
5 5 * First Introduced: 3.1
6 6 * Requires Connection: No
7 7 * Auto Activate: No
@@ -14,45 +14,113 @@
14 14 */
15 15
16 16 use Automattic\Jetpack\Redirect;
17 17
18 -/**
19 - * Load Portfolio CPT.
20 - */
21 -function jetpack_load_custom_post_types() {
22 - include __DIR__ . '/custom-post-types/portfolios.php';
18 +if ( ! defined( 'ABSPATH' ) ) {
19 + exit( 0 );
23 20 }
24 21
25 -/**
26 - * Make module configurable.
27 - */
28 -function jetpack_custom_post_types_loaded() {
29 - Jetpack::enable_module_configurable( __FILE__ );
22 +if ( ! function_exists( 'jetpack_load_custom_post_types' ) ) {
23 + if ( class_exists( 'Automattic\Jetpack\Classic_Theme_Helper\Jetpack_Portfolio' ) ) {
24 + // Temporarily require the file here to prevent possible deprecation notices for a short period of time.
25 + // @todo: Can remove this if check after the subsequent release.
26 + include __DIR__ . '/custom-post-types/portfolios.php';
27 + } else {
28 + /**
29 + * Load Portfolio CPT.
30 + *
31 + * @deprecated 13.9 Moved to Classic Theme Helper package.
32 + */
33 + function jetpack_load_custom_post_types() {
34 + _deprecated_function( __FUNCTION__, 'jetpack-13.9' );
35 + include __DIR__ . '/custom-post-types/portfolios.php';
36 + }
37 + }
30 38 }
31 -add_action( 'jetpack_modules_loaded', 'jetpack_custom_post_types_loaded' );
32 39
33 -/**
34 - * Add Settings Section for CPT
35 - */
36 -function jetpack_cpt_settings_api_init() {
37 - add_settings_section(
38 - 'jetpack_cpt_section',
39 - '<span id="cpt-options">' . __( 'Your Custom Content Types', 'jetpack' ) . '</span>',
40 - 'jetpack_cpt_section_callback',
41 - 'writing'
42 - );
40 +if ( ! function_exists( 'jetpack_custom_post_types_loaded' ) ) {
41 +
42 + if ( class_exists( 'Automattic\Jetpack\Classic_Theme_Helper\Jetpack_Portfolio' ) ) {
43 + // Temporarily require the file here to prevent possible deprecation notices for a short period of time.
44 + // @todo: Can remove this if check after the subsequent release.
45 + add_action(
46 + 'jetpack_modules_loaded',
47 + function () {
48 + Jetpack::enable_module_configurable( __FILE__ );
49 + }
50 + );
51 + } else {
52 + /**
53 + * Make module configurable.
54 + *
55 + * @deprecated 13.9 Moved to Classic Theme Helper package.
56 + */
57 + function jetpack_custom_post_types_loaded() {
58 + _deprecated_function( __FUNCTION__, 'jetpack-13.9' );
59 + Jetpack::enable_module_configurable( __FILE__ );
60 + }
61 + add_action( 'jetpack_modules_loaded', 'jetpack_custom_post_types_loaded' );
62 + }
43 63 }
44 -add_action( 'admin_init', 'jetpack_cpt_settings_api_init' );
45 64
46 -/**
47 - * Settings Description
48 - */
49 -function jetpack_cpt_section_callback() {
50 - ?>
51 - <p>
52 - <?php esc_html_e( 'Use these settings to display different types of content on your site.', 'jetpack' ); ?>
53 - <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( Redirect::get_url( 'jetpack-support-custom-content-types' ) ); ?>"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
54 - </p>
55 - <?php
65 +if ( ! function_exists( 'jetpack_cpt_settings_api_init' ) ) {
66 +
67 + if ( class_exists( 'Automattic\Jetpack\Classic_Theme_Helper\Jetpack_Portfolio' ) ) {
68 + // Temporarily require the file here to prevent possible deprecation notices for a short period of time.
69 + // @todo: Can remove this if check after the subsequent release.
70 + add_action(
71 + 'admin_init',
72 + function () {
73 + add_settings_section(
74 + 'jetpack_cpt_section',
75 + '<span id="cpt-options">' . __( 'Your Custom Content Types', 'jetpack' ) . '</span>',
76 + function () {
77 + ?>
78 + <p>
79 + <?php esc_html_e( 'Use these settings to display different types of content on your site.', 'jetpack' ); ?>
80 + <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( Redirect::get_url( 'jetpack-support-custom-content-types' ) ); ?>"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
81 + </p>
82 + <?php
83 + },
84 + 'writing'
85 + );
86 + }
87 + );
88 + } else {
89 + /**
90 + * Add Settings Section for CPT
91 + *
92 + * @deprecated 13.9 Moved to Classic Theme Helper package.
93 + */
94 + function jetpack_cpt_settings_api_init() {
95 + _deprecated_function( __FUNCTION__, 'jetpack-13.9' );
96 + add_settings_section(
97 + 'jetpack_cpt_section',
98 + '<span id="cpt-options">' . __( 'Your Custom Content Types', 'jetpack' ) . '</span>',
99 + 'jetpack_cpt_section_callback',
100 + 'writing'
101 + );
102 + }
103 + add_action( 'admin_init', 'jetpack_cpt_settings_api_init' );
104 + }
56 105 }
57 106
58 -jetpack_load_custom_post_types();
107 +if ( ! function_exists( 'jetpack_cpt_section_callback' ) ) {
108 + /**
109 + * Settings Description
110 + *
111 + * @deprecated 13.9 Moved to Classic Theme Helper package.
112 + */
113 + function jetpack_cpt_section_callback() {
114 + _deprecated_function( __FUNCTION__, 'jetpack-13.9' );
115 + ?>
116 + <p>
117 + <?php esc_html_e( 'Use these settings to display different types of content on your site.', 'jetpack' ); ?>
118 + <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( Redirect::get_url( 'jetpack-support-custom-content-types' ) ); ?>"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
119 + </p>
120 + <?php
121 + }
122 +}
123 +
124 +if ( function_exists( 'jetpack_load_custom_post_types' ) ) {
125 + jetpack_load_custom_post_types();
126 +}