-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Classic Theme Helper: Copy Portfolios Custom Post Type code to Classi…
…c Theme Helper package (#39134) Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10617464988 Upstream-Ref: Automattic/jetpack@cf49656
- Loading branch information
1 parent
2680885
commit 2608ae0
Showing
9 changed files
with
1,432 additions
and
85 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
vendor/automattic/jetpack-classic-theme-helper/src/custom-content-types.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/** | ||
* Module Name: Custom content types | ||
* Module Description: Display different types of content on your site with custom content types. | ||
* First Introduced: 3.1 | ||
* Requires Connection: No | ||
* Auto Activate: No | ||
* Module Tags: Writing | ||
* Sort Order: 34 | ||
* Feature: Writing | ||
* Additional Search Queries: cpt, custom post types, portfolio, portfolios, testimonial, testimonials | ||
* | ||
* @package automattic/jetpack-classic-theme-helper | ||
*/ | ||
|
||
use Automattic\Jetpack\Redirect; | ||
|
||
if ( ! function_exists( 'jetpack_load_custom_post_types' ) ) { | ||
/** | ||
* Load Portfolio CPT. | ||
*/ | ||
function jetpack_load_custom_post_types() { | ||
include __DIR__ . '/custom-post-types/class-jetpack-portfolio.php'; | ||
} | ||
add_action( 'init', array( '\Automattic\Jetpack\Classic_Theme_Helper\Jetpack_Portfolio', 'init' ) ); | ||
register_activation_hook( __FILE__, array( '\Automattic\Jetpack\Classic_Theme_Helper\Jetpack_Portfolio', 'activation_post_type_support' ) ); | ||
add_action( 'jetpack_activate_module_custom-content-types', array( '\Automattic\Jetpack\Classic_Theme_Helper\Jetpack_Portfolio', 'activation_post_type_support' ) ); | ||
|
||
} | ||
|
||
if ( ! function_exists( 'jetpack_custom_post_types_loaded' ) ) { | ||
/** | ||
* Make module configurable. | ||
*/ | ||
function jetpack_custom_post_types_loaded() { | ||
if ( class_exists( 'Jetpack' ) ) { | ||
Jetpack::enable_module_configurable( __FILE__ ); | ||
} | ||
} | ||
add_action( 'jetpack_modules_loaded', 'jetpack_custom_post_types_loaded' ); | ||
} | ||
|
||
if ( ! function_exists( 'jetpack_cpt_settings_api_init' ) ) { | ||
/** | ||
* Add Settings Section for CPT | ||
*/ | ||
function jetpack_cpt_settings_api_init() { | ||
add_settings_section( | ||
'jetpack_cpt_section', | ||
'<span id="cpt-options">' . __( 'Your Custom Content Types', 'jetpack-classic-theme-helper' ) . '</span>', | ||
'jetpack_cpt_section_callback', | ||
'writing' | ||
); | ||
} | ||
add_action( 'admin_init', 'jetpack_cpt_settings_api_init' ); | ||
} | ||
|
||
if ( ! function_exists( 'jetpack_cpt_section_callback' ) ) { | ||
/** | ||
* Settings Description | ||
*/ | ||
function jetpack_cpt_section_callback() { | ||
if ( class_exists( 'Redirect' ) ) { | ||
?> | ||
<p> | ||
<?php esc_html_e( 'Use these settings to display different types of content on your site.', 'jetpack-classic-theme-helper' ); ?> | ||
<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-classic-theme-helper' ); ?></a> | ||
</p> | ||
<?php | ||
} | ||
} | ||
} | ||
|
||
if ( function_exists( 'jetpack_load_custom_post_types' ) ) { | ||
|
||
jetpack_load_custom_post_types(); | ||
|
||
} |
Oops, something went wrong.