Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Custom post types: Ensure features remain available when theme support is added.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public function maybe_register_cpt() {

// CPT magic.
$this->register_post_types();
if ( ! post_type_exists( self::CUSTOM_POST_TYPE ) ) {
return;
}
add_action( sprintf( 'add_option_%s', self::OPTION_NAME ), array( $this, 'flush_rules_on_enable' ), 10 );
add_action( sprintf( 'update_option_%s', self::OPTION_NAME ), array( $this, 'flush_rules_on_enable' ), 10 );
add_action( sprintf( 'publish_%s', self::CUSTOM_POST_TYPE ), array( $this, 'flush_rules_on_first_project' ) );
Expand Down Expand Up @@ -157,6 +160,9 @@ public function maybe_register_cpt() {
*/
public static function site_should_display_portfolios() {
$should_display = true;
if ( current_theme_supports( self::CUSTOM_POST_TYPE ) ) {
return true;
}
if ( ( ! ( new Host() )->is_wpcom_simple() ) && Blocks::is_fse_theme() ) {
if ( ! get_option( self::OPTION_NAME, '0' ) ) {
$should_display = false;
Expand Down Expand Up @@ -880,10 +886,13 @@ private static function portfolio_query( $atts ) {
// Default query arguments.
$default = array(
'order' => $atts['order'],
'orderby' => $atts['orderby'],
'posts_per_page' => $atts['showposts'],
);

if ( ! empty( $atts['orderby'] ) ) {
$default['orderby'] = $atts['orderby'];
}

$args = wp_parse_args( $atts, $default );
$args['post_type'] = self::CUSTOM_POST_TYPE; // Force this post type.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public function maybe_register_cpt() {

// CPT magic
$this->register_post_types();
if ( ! post_type_exists( self::CUSTOM_POST_TYPE ) ) {
return;
}
add_action( sprintf( 'add_option_%s', self::OPTION_NAME ), array( $this, 'flush_rules_on_enable' ), 10 );
add_action( sprintf( 'update_option_%s', self::OPTION_NAME ), array( $this, 'flush_rules_on_enable' ), 10 );
add_action( sprintf( 'publish_%s', self::CUSTOM_POST_TYPE ), array( $this, 'flush_rules_on_first_testimonial' ) );
Expand Down Expand Up @@ -155,6 +158,10 @@ public function maybe_register_cpt() {
*/
public static function site_should_display_testimonials() {
$should_display = true;
if ( current_theme_supports( self::CUSTOM_POST_TYPE ) ) {
return true;
}

if ( ( ! ( new Host() )->is_wpcom_simple() ) && Blocks::is_fse_theme() ) {
if ( ! get_option( self::OPTION_NAME, '0' ) ) {
$should_display = false;
Expand Down Expand Up @@ -774,10 +781,13 @@ private static function jetpack_testimonial_shortcode_html( $atts ) {
// Default query arguments
$defaults = array(
'order' => $atts['order'],
'orderby' => $atts['orderby'],
'posts_per_page' => $atts['showposts'],
);

if ( ! empty( $atts['orderby'] ) ) {
$defaults['orderby'] = $atts['orderby'];
}

$args = wp_parse_args( $atts, $defaults );
$args['post_type'] = self::CUSTOM_POST_TYPE; // Force this post type
$query = new WP_Query( $args );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Custom post types: Ensure features remain available when theme support is added.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: compat

Custom post types: Ensure features remain available when theme support is added.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Custom post types: Ensure features remain available when theme support is added.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Custom post types: Ensure features remain available when theme support is added.
Loading