Skip to content

Commit

Permalink
Fix missing occurences of getPostType method
Browse files Browse the repository at this point in the history
  • Loading branch information
datengraben committed Jan 3, 2025
1 parent efc7670 commit 9dde2bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion includes/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function ( $posts, $query ) {

// Add filter to change post counts in admin lists for custom post types.
foreach ( Plugin::getCustomPostTypes() as $custom_post_type ) {
add_filter( 'views_edit-' . $custom_post_type::getPostType(), 'commonsbooking_custom_view_count', 10, 1 );
add_filter( 'views_edit-' . $custom_post_type, 'commonsbooking_custom_view_count', 10, 1 );
}

// Filter function for fix of counts in admin lists for custom post types.
Expand Down
12 changes: 6 additions & 6 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ private static function getCustomPostTypeClasses() {
/**
* @return CustomPostType[] instantiated objects
*/
private static function getCustomPostTypeObjects() {
public static function getCustomPostTypeObjects() {
return array_map(
function ( $type ) {
return new ($type)();
return new $type();
},
self::getCustomPostTypeClasses()
);
Expand All @@ -200,7 +200,7 @@ function ( $type ) {
private static function getCBManagerCustomPostTypesObjects() {
return array_map(
function ( $type ) {
return new ($type)();
return new $type();
},
self::getCBManagerCustomPostTypeClasses()
);
Expand Down Expand Up @@ -433,7 +433,7 @@ public static function filterAdminBodyClass( $classes ) {
* Registers custom post types.
*/
public static function registerCustomPostTypes() {
foreach ( self::getCustomPostTypes() as $customPostType ) {
foreach ( self::getCustomPostTypeObjects() as $customPostType ) {
$cptArgs = $customPostType->getArgs();
//make export possible when using WP_DEBUG, this allows us to use the export feature for creating new E2E tests
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
Expand Down Expand Up @@ -948,7 +948,7 @@ public function setParentFile( $parent_file ): string {
// Set 'cb-dashboard' as parent for cb post types
if ( in_array( $current_screen->base, array( 'post', 'edit' ) ) ) {
foreach ( self::getCustomPostTypes() as $customPostType ) {
if ( $customPostType::getPostType() === $current_screen->post_type ) {
if ( $customPostType === $current_screen->post_type ) {
return 'cb-dashboard';
}
}
Expand Down Expand Up @@ -983,7 +983,7 @@ public function getTheContent( $content ): string {
// Check if we're inside the main loop in a single post page.
if ( is_single() && in_the_loop() && is_main_query() ) {
global $post;
foreach ( self::getCustomPostTypes() as $customPostType ) {
foreach ( self::getCustomPostTypeClasses() as $customPostType ) {
if ( $customPostType::getPostType() === $post->post_type ) {
return $content . $customPostType::getView()::content( $post );
}
Expand Down

0 comments on commit 9dde2bf

Please sign in to comment.