Skip to content

Commit

Permalink
Classic Theme Helper: Copy Portfolios Custom Post Type code to Classi…
Browse files Browse the repository at this point in the history
…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
coder-karen authored and matticbot committed Aug 29, 2024
1 parent 2680885 commit 2608ae0
Show file tree
Hide file tree
Showing 9 changed files with 1,432 additions and 85 deletions.
58 changes: 29 additions & 29 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This is an alpha version! The changes listed here are not final.

### Added
- Classic Theme Helper: Adding Portfolio custom post type content
- Content Options: Moving content to Classic Theme Helper package.

### Changed
Expand Down
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();

}
Loading

0 comments on commit 2608ae0

Please sign in to comment.