Skip to content

Show post types on home screens#25233

Open
crazytonyli wants to merge 9 commits intoprototype-custom-post-types-localfrom
custom-post-types-remove-task
Open

Show post types on home screens#25233
crazytonyli wants to merge 9 commits intoprototype-custom-post-types-localfrom
custom-post-types-remove-task

Conversation

@crazytonyli
Copy link
Contributor

Note

This PR will be merged after #25208.

Description

There are two main changes:

  1. The custom posts list now looks similar to the Posts & Pages screens, using a tab view to filter by post status.
  2. The custom post types can now be directly accessed from the home screens (Dashboard for .com sites, and "Blog Details" for self-hosted sites).
cpt-list.mov

@crazytonyli crazytonyli added this to the 26.7 milestone Feb 10, 2026
@crazytonyli crazytonyli requested a review from kean February 10, 2026 07:55
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 10, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number30922
VersionPR #25233
Bundle IDorg.wordpress.alpha
Commit67d950e
Installation URL0a0nc3tceiko8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 10, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number30922
VersionPR #25233
Bundle IDcom.jetpack.alpha
Commit67d950e
Installation URL7mcf1cc64nbe8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 10, 2026

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

}

// TODO:
// - Log errors to sentry: https://github.com/wordpress-mobile/WordPress-iOS/pull/25157#discussion_r2785458461
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty easy to do with wpAssertionFailure and error included in user info. I did use these to monitor sync errors for posts.

// filterBarContainer.backgroundColor = .systemGroupedBackground // .secondarySystemGroupedBackground
filterBarContainer.contentView.addSubview(filterBar)
filterBar.pinEdges(.top, to: filterBarContainer.safeAreaLayoutGuide, insets: UIEdgeInsets(.top, -filterBar.tabBarHeight))
filterBar.pinEdges(.top, to: filterBarContainer.safeAreaLayoutGuide, insets: UIEdgeInsets(.top, -AdaptiveTabBar.tabBarHeight))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it includes some unrelated changes. Does it need a rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes are related (see #25233 (comment)). I extracted the value to a constant, to be reused in the CPT list view.

import WordPressData

@propertyWrapper
struct SiteStorage<Value: Codable>: DynamicProperty {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is clever. Does it work as an observable property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a SwiftUI preview to test this property wrapper. The preview code does not go through the .init(key:blog:) initialiser, because we don't have a blog id instance. But the core logic is tested.

)

if FeatureFlag.customPostTypes.enabled && blog.supportsCoreRESTAPI {
let pinned = SiteStorageAccess.pinnedPostTypes(for: TaggedManagedObjectID(blog))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this PR and a CPT I use for testing automatically appeared on the dashboard, which I'm not sure is what we want by default because the space is limited. I also don't see an option to configure it under "Personalization".

Image Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took your suggestion here (p1770673465795309/1770627105.176769-slack-C04PWEZSYFL), maybe I misunderstood it?

I would probably simply inline these items in the top-level menu.

I didn't reuse the personalization because there is already a pin and unpin in the post types list. But I can look into unifying how they store values into UserDefaults.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should've been clearer in that message. The suggestion was to add them directly in the "Content" menu in the site details as opposed to displaying all CPTs under "More Content", which it now does. As for the Dashboard, I'd probably keep it opt-in (you can add CPTs there if you want). The "quick actions" menu is intentionally short, so it doesn't overshadow the cards below.

Screenshot 2026-02-12 at 6 40 02 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 08f0c96

import WordPressUI
import WordPressData

struct CustomPostTabView: View {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear if these changes are related to the PR, so I skipped reviewing them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these changes are intentionally included in this PR. I don't want to create another chained PR, considering the changes are relatively small (from the filter design to tab design).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, I'll review them as well tomorrow. Thank you.


private let mapping: [String: String] = [
// Commerce & Products
"products": "shippingbox",
Copy link
Contributor

@kean kean Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already mentioned on other threads, but these icons don't fit well with the menus, and should ideally be updated to use Gutenberg icons.

In the case of my site, the two icons look different. I'm not sure if there are default icons though.

Image Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have looked into reusing Gutenberg icons and will share some screenshots later.

The only solution for matching wp-admin icons is using dashicons. As discussed in p1769760142081339-slack-C06S1QS55K9, I don't think we want to use them in the app.

At the moment, the CPT icons (set by plugin author) are mapped to SF symbols. We can expand the mapping as we go. But I imagine we don't have many choices if we map the icons to Gutenberg icons, which is a much smaller set than SF symbols.

Nonetheless, I think we can probably address this in a separate PR.

@crazytonyli crazytonyli force-pushed the custom-post-types-remove-task branch from 9704712 to 10bc524 Compare February 13, 2026 03:55
@crazytonyli crazytonyli requested a review from kean February 13, 2026 03:55
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants