| 1 |
<?php |
| 2 |
/** |
| 3 |
* Module Name: Custom content types |
| 4 |
* Module Description: Display different types of content on your site with custom content types. |
| 5 |
* First Introduced: 3.1 |
| 6 |
* Requires Connection: No |
| 7 |
* Auto Activate: No |
| 8 |
* Module Tags: Writing |
| 9 |
* Sort Order: 34 |
| 10 |
* Feature: Writing |
| 11 |
* Additional Search Queries: cpt, custom post types, portfolio, portfolios, testimonial, testimonials |
| 12 |
* |
| 13 |
* @package automattic/jetpack |
| 14 |
*/ |
| 15 |
|
| 16 |
use Automattic\Jetpack\Redirect; |
| 17 |
|
| 18 |
if ( ! defined( 'ABSPATH' ) ) { |
| 19 |
exit( 0 ); |
| 20 |
} |
| 21 |
|
| 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 |
} |
| 38 |
} |
| 39 |
|
| 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 |
} |
| 63 |
} |
| 64 |
|
| 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 |
} |
| 105 |
} |
| 106 |
|
| 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 |
} |
| 127 |
|