| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Module Name: Custom content types |
| 5 |
* Module Description: Display different types of content on your site with custom content types. |
| 6 |
* First Introduced: 3.1 |
| 7 |
* Requires Connection: No |
| 8 |
* Auto Activate: Yes |
| 9 |
* Module Tags: Writing |
| 10 |
* Sort Order: 34 |
| 11 |
* Feature: Writing |
| 12 |
* Additional Search Queries: cpt, custom post types, portfolio, portfolios, testimonial, testimonials |
| 13 |
*/ |
| 14 |
|
| 15 |
function jetpack_load_custom_post_types() { |
| 16 |
include dirname( __FILE__ ) . "/custom-post-types/portfolios.php"; |
| 17 |
} |
| 18 |
|
| 19 |
function jetpack_custom_post_types_loaded() { |
| 20 |
Jetpack::enable_module_configurable( __FILE__ ); |
| 21 |
Jetpack::module_configuration_load( __FILE__, 'jetpack_custom_post_types_configuration_load' ); |
| 22 |
} |
| 23 |
add_action( 'jetpack_modules_loaded', 'jetpack_custom_post_types_loaded' ); |
| 24 |
|
| 25 |
function jetpack_custom_post_types_configuration_load() { |
| 26 |
wp_safe_redirect( admin_url( 'options-writing.php#cpt-options' ) ); |
| 27 |
exit; |
| 28 |
} |
| 29 |
|
| 30 |
// Add Settings Section for CPT |
| 31 |
function jetpack_cpt_settings_api_init() { |
| 32 |
add_settings_section( |
| 33 |
'jetpack_cpt_section', |
| 34 |
'<span id="cpt-options">' . __( 'Your Custom Content Types', 'jetpack' ) . '</span>', |
| 35 |
'jetpack_cpt_section_callback', |
| 36 |
'writing' |
| 37 |
); |
| 38 |
} |
| 39 |
add_action( 'admin_init', 'jetpack_cpt_settings_api_init' ); |
| 40 |
|
| 41 |
/* |
| 42 |
* Settings Description |
| 43 |
*/ |
| 44 |
function jetpack_cpt_section_callback() { |
| 45 |
?> |
| 46 |
<p> |
| 47 |
<?php esc_html_e( 'Use these settings to display different types of content on your site.', 'jetpack' ); ?> |
| 48 |
<a target="_blank" href="http://jetpack.com/support/custom-content-types/"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a> |
| 49 |
</p> |
| 50 |
<?php |
| 51 |
} |
| 52 |
|
| 53 |
jetpack_load_custom_post_types(); |
| 54 |
|