canonical-urls
2 months ago
carousel
2 days ago
comment-likes
6 months ago
comments
1 week ago
custom-post-types
3 months ago
external-media
6 months ago
google-fonts
4 months ago
gravatar
5 years ago
infinite-scroll
1 week ago
likes
1 week ago
markdown
1 week ago
memberships
1 week ago
photon-cdn
1 month ago
plugin-search
4 weeks ago
post-by-email
6 months ago
related-posts
2 days ago
scan
2 months ago
seo-tools
1 week ago
sharedaddy
1 week ago
shortcodes
1 week ago
shortlinks
1 week ago
simple-payments
6 months ago
site-icon
6 months ago
sitemaps
1 week ago
stats
5 months ago
subscriptions
2 days ago
theme-tools
2 weeks ago
tiled-gallery
1 week ago
verification-tools
2 weeks ago
videopress
1 week ago
widget-visibility
1 week ago
widgets
2 days ago
woocommerce-analytics
1 month ago
wordads
1 month ago
wpcom-tos
5 months ago
account-protection.php
1 month ago
blaze.php
6 months ago
blocks.php
6 months ago
canonical-urls.php
3 months ago
carousel.php
6 months ago
comment-likes.php
6 months ago
comments.php
2 months ago
contact-form.php
6 months ago
copy-post.php
2 weeks ago
custom-content-types.php
1 month ago
google-fonts.php
1 month ago
gravatar-hovercards.php
1 week ago
infinite-scroll.php
6 months ago
json-api.php
6 months ago
latex.php
1 week ago
likes.php
4 weeks ago
markdown.php
6 months ago
module-extras.php
6 months ago
module-headings.php
1 week ago
module-info.php
3 months ago
monitor.php
2 days ago
notes.php
5 months ago
photon-cdn.php
6 months ago
photon.php
6 months ago
plugin-search.php
4 weeks ago
post-by-email.php
1 month ago
post-list.php
6 months ago
protect.php
1 month ago
publicize.php
6 months ago
related-posts.php
2 weeks ago
search.php
6 months ago
seo-tools.php
6 months ago
sharedaddy.php
3 months ago
shortcodes.php
6 months ago
shortlinks.php
2 weeks ago
simple-payments.php
6 months ago
sitemaps.php
6 months ago
sso.php
6 months ago
stats.php
1 week ago
subscriptions.php
1 week ago
theme-tools.php
6 months ago
tiled-gallery.php
6 months ago
vaultpress.php
6 months ago
verification-tools.php
1 month ago
videopress.php
6 months ago
waf.php
6 months ago
widget-visibility.php
6 months ago
widgets.php
6 months ago
woocommerce-analytics.php
6 months ago
wordads.php
6 months ago
wpcom-reader.php
3 months ago
wpgroho.js
1 year ago
custom-content-types.php
127 lines
| 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 |