Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Gutenberg in WP categories #17099

Open
Tracked by #41241
FerrielMelarpis opened this issue Aug 20, 2019 · 56 comments
Open
Tracked by #41241

Enabling Gutenberg in WP categories #17099

FerrielMelarpis opened this issue Aug 20, 2019 · 56 comments
Labels
[Feature] Blocks Overall functionality of blocks [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. Needs Design Needs design efforts. Needs Technical Feedback Needs testing from a developer perspective. [Type] Feature New feature to highlight in changelogs.

Comments

@FerrielMelarpis
Copy link

Related thread: https://wordpress.org/support/topic/gutenberg-category-editor/

Not sure if this is possible now but I haven't seen any documentation regarding this.

Is WP category going to be supported by Gutenberg as well?

Right now, for our use case, we depend on ACF to contain the data needed for representing the structure for our category pages. It would be nice to have a way to represent the category data as blocks as well.

@talldan talldan added the [Type] Question Questions about the design or development of the editor. label Aug 22, 2019
@TenentePM
Copy link

Same here, I'd like to edit category-descriptions with Gutenberg.

@Flaschenzug
Copy link

I'd like that too! Wordpress has taken a big step with Gutenberg. But this step is only meaningful if it is also consistent. Why shouldn't the categories be handled in the same way as posts and pages?

@mtias
Copy link
Member

mtias commented Aug 30, 2020

This would be a cool idea

@mtias mtias added [Feature] Blocks Overall functionality of blocks [Type] Feature New feature to highlight in changelogs. Needs Design Needs design efforts. Needs Technical Feedback Needs testing from a developer perspective. and removed [Type] Question Questions about the design or development of the editor. labels Aug 30, 2020
@danyork
Copy link

danyork commented Mar 15, 2021

Just noting that several of us left comments expressing our support for this task over in the now-closed #12511 .

For my employer's main site, we use category archives pages extensively in the navigation and main design. They are currently built them out using ACF with rows of text, images, etc. above the posts for the category (or tag). We've been doing more and more with the block editor across our site and building some excellent pages. We really want to now use some of the Gutenberg blocks and techniques on the Category pages as well (and also Tag archive pages - but our priority is on the Category pages).

Unfortunately, I don't have the programming expertise to help with the work, but I would be glad to help with whatever testing is needed!

@Jeff1Jeff
Copy link

Jeff1Jeff commented Jun 10, 2021

We use Woocommerce category pages as a main landing pages in our store. This structure is pretty common for many stores. And abundance of Gutenberg editor on category pages really restricts further development of our site, I think category and taxonomy pages should be treated as posts and pages and have similar functionality to them.

Also when I want to add a link Gutenberg isn't showing Woocomerce category pages as available option.

@paaljoachim
Copy link
Contributor

This post, by @gziolo mentions new filters/hooks that seems to make easier to blockify the WP categories page. (Recreate it with Gutenberg.) https://make.wordpress.org/core/2021/06/16/block-editor-api-changes-to-support-multiple-admin-screens-in-wp-5-8/

@critterverse @javierarce
Perhaps this would be an interesting screen to design.

@gziolo
Copy link
Member

gziolo commented Jun 21, 2021

@paaljoachim, as explained in my response to your comment on a linked post, it's a more complex process to enable the block editor on a new screen that using a few API methods described in the dev note. The widgets screen might be a good way to think about it. It took a lot of effort to get the block paradigm integrated there.

@paaljoachim
Copy link
Contributor

Thank you Greg!

@skorasaurus
Copy link
Member

skorasaurus commented Jan 6, 2022

With the increased focus and transition to full site editing; this shouldn't be forgotten :)

#37746 has a clear use case that reminds me some retail/woocommerce shops use categories extensively.

@gingerling
Copy link

Hi, now that there are templates for category and product category pages coming out, this issue becomes more important I think.

In my view there is no "full site editing" without this vital feature.

I can totally see people doing hacky things like making a separate template for each category page, for example.

How to we get this issue on the roadmap? I have no idea of the scale of this task. Could we team up and try and fund some development on this? Seems like a fair few WooCommerce stores on here!

@only-sadeghi
Copy link

is there a way to do it?🥺😐

@gingerling
Copy link

gingerling commented Jan 12, 2022

is there a way to do it?pleading_faceneutral_face

Hi, this https://en-gb.wordpress.org/plugins/visual-term-description-editor/ gives a basic editor, but not a block editor. Perhaps this in combination with the new theme editor for category archives will allow a better experience while this issue is worked on

Please, if you have other suggested plugins add them while it's not a support forum I think it's helpful for us to assess the need and current capabilities

@sangtlee
Copy link

sangtlee commented Jan 27, 2022

We would also love to see block editing enabled on term edit screens. It's not uncommon to need block editing features on entities that need to function as taxonomy terms. This is our current workaround to accomplish this:

  • Custom post type called "Industry" with rewrite set to false << all of the "block" content is managed on these posts
  • Custom taxonomy called "Industries" with slug of "industries" << used for usual taxonomy tagging, querying, etc
    -- Taxonomy has a ACF post object field ("parent_post") that lets editors associate this term with a specific "industry" post
  • Content items across the site can then be tagged with an Industries term, but when the term archive page is requested, we grab the Block content from the associated page and inject that into the archive page template above the normal loop output << this task is rather trivial with Timber/Twig:
{% set parent_post = Post(post.parent_post) %}
  {{ parent_post.content }}
  • Some additional rewrites and customs are needed to ensure users don't end up on the CPT post, breadcrumbs, etc.

It's not elegant but it works...new editors get confused between the "Industry" CPT and the "Industries" taxonomy...and often they forget about that all-important "parent_post" field on the term.

@jwflory
Copy link

jwflory commented Feb 6, 2022

Another +1 for this feature… the use case I had was to add a Jetpack newsletter subscription widget at the top of a category. Personalizing the category page is an important part of how we use WordPress.

CC: @vansika

@MrVibe
Copy link

MrVibe commented May 7, 2022

How can WordPress be upgraded to FSE without supporting this feature ?

@klockfeber
Copy link

This would be very useful for our category pages as well, see an example of how the content looks now when it is only text here. I am surprised that WordPress 6.0 was released without Gutenberg on categories.

@Jabe64
Copy link

Jabe64 commented Jun 4, 2022

+1 I created an issue about it 4 years ago:
#12511

The issue was closed because Gutenberg was still in early stage. Full Site Editing improves but still no news about this.

Every update I hope to see something then my hopes varnish 😢

@mtias Is it still considered or will categories description be abandoned and should we use FSE template per category instead? 🤔

@MathieuMarteau
Copy link

I also don't understand why this feature is still not present. So many people use taxonomies and categories... It's frustrating not to be able to use our modular blocks on this kind of page. Please do something about it...

@djcowan
Copy link
Contributor

djcowan commented Nov 30, 2023

I'd rather the community remained focused on refactoring Wordpress' core functionality. Oh, and the incredible work they're doing with accessibility.

@jonathan-dejong
Copy link

I'd rather the community remained focused on refactoring Wordpress' core functionality. Oh, and the incredible work they're doing with accessibility.

I don't understand this comment. The community can do more than one thing at once.
Also wouldn't this very much be qualified as "refactoring WordPress core functionality" anyway 🤔

@paaljoachim
Copy link
Contributor

The thing is that anyone can spend a bit of time adding wireframes/mockup with suggestions as to how this might look like. That will create some motion. It will naturally need a bit forth and back in regards to design. After a design has been decided upon then a developer can go ahead and create a PR (Pull Request) and so the coding exploration begins. Core designers and developers will need to also give feedback along the way.

@djcowan
Copy link
Contributor

djcowan commented Dec 2, 2023

Yes, I agree, the community, contributors, and core team can work together on multiple facets of the system.
But when I referred to 'core' functionality, I was thinking more in term of the Wordpress' core DNA rather than the core application code.
Sure, there are many volunteer contributors and there can always be room for more but the project needs to be planned, coordinated, managed and rigorously tested as well. This obviously includes the code, which is a minefield in itself but also requires input and advice from the teams who work on accessibility, design, user experience, marketing, translation and more besides.
I've personally not contributed so I am not one to complain but @paaljoachim is correct, there are lots of ways for each of us to become involved. I apologise if my comment caused undue offence. It was not intended as such.

@sangtlee
Copy link

sangtlee commented Dec 6, 2023

IMHO, taxonomy terms should retain all existing functionality...i.e. name, slug, parent terms, description, tag_id, archives...and layer in the new aspects: block editor, templates, draft/published states, featured image, and author. A quick mockup of the merged UI might look like the attached.

term_block_add_mockup

@jonathan-dejong
Copy link

@djcowan Not at all, I just didn't understand the statement and it didn't really feel like it contributed to the discussion.
I'm sorry you felt the need to apologise :)

@sangtlee I like that rough mockup. It makes sense to actually put those fixed fields currently on the term edit screen as fixed fields in the sidebar.

AFAIK the things to cover would be:

  • slug
  • Parent
  • Description

Slug would be auto-populated by title same as current behaviour.

I still think it would be nicer to not have description as a fixed field but I recognise that its probably a must to maintain decent backwards compatibility.

@legshooter
Copy link

Same as many others mentioned, old-time WP'er here that was a way for a while, and kinda astonished that in 2024 Taxonomies are still not treated like posts/pages by the entire ecosystem. Slugs, revisions, SEO plugins, etc. etc. are all needed and missing, and we're left hacking away with ACF.

@samunderwood
Copy link

I've noticed a trend where many websites use WordPress's taxonomy system for organising content in the backend, but don't utilise taxonomy term pages on the frontend due to its limited flexibility for content.

They're instead using pages, which are then supplemented with custom blocks to display the post list, alongside all the other custom blocks they want to be able to use on term pages.

I'm still surprised how long Gutenberg has been out and we still are relying on hacky workarounds to use its functionality on something as prevalent on websites as category pages

@gregdotelphotography
Copy link

This is a must have for Wordpress. I have 5 websites and all of them need this feature. I have to use hacks for it to work properly.

@asafm7
Copy link

asafm7 commented Apr 29, 2024

I recently posted a message about it in the core-editor WordPress Slack channel:

https://wordpress.slack.com/archives/C02QB2JS7/p1714163585750229

Feel free to chime in.

@jonathan-dejong
Copy link

jonathan-dejong commented Apr 29, 2024

I recently posted a message about it in the core-editor WordPress Slack channel:

https://wordpress.slack.com/archives/C02QB2JS7/p1714163585750229

Feel free to chime in.

Hah okay .. ill buy that the issue title could be clearer but when it was created there wasn't a proposal, just a grievance to discuss.
The thing is.. my experience is that when I create a new issue to address something that already exists, the issue gets closed immediately referencing that "there is already an issue for this".

So I'm curious what the process looks like here.

I wouldn't mind taking the time to create a new structured issue with a clear title provided that the approach I've had in mind is sound. But I would like to know:

  1. Is it sound? From someone actually part of the Gutenberg team.
  2. Will it not just be closed as a duplicate? What is the defined process (if any)?

I'm not intentionally trying to come off as a bit sour here, but Ive experienced too many times that my efforts to contribute to this OS projects haven't made the slightest change due to the gatekeepers disinterest.

For reference here's my proposal (and then there's som discussions around it later in the comments)
#17099 (comment)

@colorful-tones
Copy link
Member

I recently posted a message about it in the core-editor WordPress Slack channel:
https://wordpress.slack.com/archives/C02QB2JS7/p1714163585750229
Feel free to chime in.

That was me suggesting in Slack 👋

the issue title could be clearer but when it was created there wasn't a proposal, just a grievance to discuss.

I feel like #37746 does a far better job explaining (with screenshots) what the issue is and the suggested solution. I have the ability to edit this Issue's (17099) description and title, but I feel like it could be misleading for the original creator: @FerrielMelarpis. This was why I suggested we think about creating a new issue with a reference to this issue (17099), and then close it.

For what its worth - I think this overall functionality will eventually be explored in the Phase 3: WordPress admin redesign #53322. 👈 I highly recommend folks review the videos and overall conversation and contribute your feedback on #53322. Here are some screenshots (please see below) of areas that could possibly be explored for the category screen (please do not read this and assume it is fact - it is currently being discussed and you should feel empowered to contribute your thoughts) based on @SaxonF original video artifacts in #53322

There may even be more recent work that is moving closer to the category redesign, but I just could not find it when searching through the many issues. 😄

Screenshot 2024-04-29 at 2 21 00 PM
Screenshot 2024-04-29 at 2 22 00 PM

@asafm7
Copy link

asafm7 commented Aug 21, 2024

@colorful-tones, I went over the issue you mentioned, but, unless I'm missing something, it doesn't seem to be closely related to the issue of enabling the Block Editor for archive page descriptions. The issue you referred to also feels like an extensive project, making it unlikely to progress significantly soon.

Do you think there is another way to raise and promote the issue presented in this thread?

@djcowan
Copy link
Contributor

djcowan commented Aug 22, 2024

Might it suffice to add block support to the category description editor.
Similar to the support/issue reporting field in the Wordpress codex. Perhaps implemented in a similar way to the Freeform core/ block? image

As a postscript. Adding a Category image programmatically has always required a conditional check or adapter for woocommerce, third-party brand plugins etc. it would be nice to standardise the term post meta

@goaround
Copy link

goaround commented Aug 22, 2024

I submitted a PR Automattic/blocks-everywhere#178 to Blocks Everywhere to enable Gutenberg for the term description. It works quite well with the help of @1ucay. Feel free to give it a try.
As far as I know, Blocks Everywhere is used in bbPress as well.

The only issue is that Blocks Everywhere requires the Gutenberg Plugin. That holds me back from using it in production.

@asafm7
Copy link

asafm7 commented Aug 22, 2024

@djcowan @goaround it looks like a good direction.

The Blocks Everywhere plugin has only about 30 active installs though, and hasn't been updated for 10 months. Adding the fact that as @goaround mentioned it requires the Gutenberg plugin which is beta by definition, it doesn't feel like a good solution for production.

Maybe a similar solution can be brought to core as a temporary solution until the admin side gets refactored (which I assume can take a long while).

@kraftner
Copy link

Maybe a similar solution can be brought to core as a temporary solution until the admin side gets refactored (which I assume can take a long while).

While I am also desperately waiting for this I have to strongly disagree here. Due to the backwards compatibility commitment of WP nothing ever is temporary. If it takes time that sucks but is still better than getting a half-baked stopgap solution that will only cause much more pain in the long term.

Just as an idea: If you really need something like this a competent developer could probably create a stop-gap solution that e.g. creates a post type that shadows a taxonomy and keeps them in sync. Honestly though if anyone has the time or money to fund that it would probably be better spent in working on the core admin overhaul.

@asafm7
Copy link

asafm7 commented Aug 22, 2024

@kraftner that's interesting.

I understand what you are saying, but I'm not sure it applies here.

I feel like moving away from the current admin to the new editor experience is something that is bound to happen, so a temporary fix won't prevent it from happening. It will take time though. I'm not familiar with the process, but my gut feeling is that it can take years (again, just a gut feeling).

If you really need something like this a competent developer could probably create a stop-gap solution that e.g. creates a post type that shadows a taxonomy and keeps them in sync.

Yes, something like this can be created, but such a workaround also needs to be maintained and is prone to breaking.

Considering that moving away from the current admin will eventually happen, that it will take time though, that many people need this change in the meantime, and that a decent fix has already been found and implemented (just not in a stable way), I don't see a true downside in bringing this change to core.

It can be disabled by default and enabled with a filter or a similar method.

But maybe I'm missing something.

@kauaicreative
Copy link

kauaicreative commented Aug 22, 2024

On a recent build I needed this functionality. My solution was to create a block that displays related page data in the archive template - I place this block into the archive template. The block checks if a page existed with the same permalink as the archive e.g. services/planning. If there is a match then I insert that page content into the block. This was a nice solution because the client only needs to edit the related page and I can continue to use the term description in the archive template as it was intended. You can see it in action here https://destinationbydesign.com/services/

This could just as easily be done with a simple shortcode:

// Place [page-content] anywhere in the archive template
// And make sure that there is a page with the exact same permalink e.g. services/planning

add_shortcode( 'page-content', function ( $atts, $content = '' ) {
  global $wp;
  
  if ( is_tax() ) {
	  $taxonomy_slug = add_query_arg( [], $wp->request ); // e.g. 'services/recreation-master-planning'
	  $page          = get_page_by_path( $taxonomy_slug );
	  if ( isset( $page->post_status ) && $page->post_status === 'publish' ) {
		  $content = do_blocks( $page->post_content );
	  }
  }
  
  return $content;
} );

@WesCook
Copy link

WesCook commented Aug 22, 2024

I came up with a similar solution, @kauaicreative. Instead of modifying a template, I wrote a function to serve a regular page instead of a category page if it matches the same path. Specifically it looks for matching slugs under a child page /category-replacements/ to keep things organized. That page can be hidden or redirected to avoid duplicate content issues.

// Replace any category pages with a regular page of the same slug found under the /category-replacements/ parent
add_action('template_redirect', function() {
	// Do nothing in wp-admin
	if (is_admin()) {
		return $query_vars;
	}

	if (is_product_category()) {
		// Get the current category object
		$current_category = get_queried_object();

		// Get the full URL of the category
		$category_url = get_term_link($current_category);

		// Parse the URL to get the path
		$parsed_url = parse_url($category_url, PHP_URL_PATH);

		// Remove leading and trailing slashes, then replace slashes with hyphens
		$category_path = trim($parsed_url, '/');
		$page_slug = str_replace('/', '-', $category_path);

		// Check if the parent page exists
		$parent_page = get_page_by_path('category-replacements');

		if ($parent_page) {
			// Get the ID of the parent page
			$parent_id = $parent_page->ID;

			// Query for a child page with the constructed slug under the parent page
			$args = array(
				'name'        => $page_slug,
				'post_type'   => 'page',
				'post_parent' => $parent_id,
				'numberposts' => 1
			);
			$child_pages = get_posts($args);

			if (!empty($child_pages)) {
				// Redirect to the child page template
				global $wp_query;
				$wp_query->is_page = true;
				$wp_query->is_single = false;
				$wp_query->is_category = false;
				$wp_query->queried_object_id = $child_pages[0]->ID;
				$wp_query->post = $child_pages[0];
				$wp_query->post_count = 1;
				$wp_query->posts = array($child_pages[0]);

				// Set up the post data
				setup_postdata($child_pages[0]);

				// Use the child page template
				include(get_page_template($child_pages[0]->ID));
				exit;
			}
		}
	}
});

For example, if you wanted to replace the Services > Accounting subcategory (/services/accounting/), then you'd create a regular page at the path /category-replacements/services-accounting/. The top-level page is always required, and hyphens are used to separate children after that.

It's definitely a hack, but it does work. Of course I'll dismantle it the very day that WordPress gets native support for Gutenberg in categories. Especially for cases like WooCommerce that require feature-rich content, the classic text editor just doesn't cut it anymore.

My thanks to anyone working on this problem. I hope that any potential solution will also be available in classic themes, and not exclusive to block themes.

@sangtlee
Copy link

Good to see some chatter on this again! I agree with @kraftner and others that you can achieve what we need with technical workarounds...but IMHO, the real benefit of enabling Gutenberg natively in Term edit pages is improving content editor user experience. Workarounds like mine, using shadow posts or ones using shortcodes inside term description fields are not very intuitive to content editors.

My team also works with Drupal...and almost every Drupal site we've built has at least one Taxonomy (e.g. blog category or degree program) with Terms in those Taxonomies that have block content managed on them which is then displayed on the Term pages...and the content mgmt experience in the Term page is the same as any other block-enabled page.

So what is the typical dev workflow for changes to core? Can anyone submit PR's? Or must the work be initiated by a core maintainer? How can we elevate the visibility of this? This thread is 5 years old.

@djcowan
Copy link
Contributor

djcowan commented Aug 29, 2024

It can be disabled by default and enabled with a filter or a similar method.


Would love an opt-in mechanism via theme_support, hook or filter.
The post except field includes the [excerpt_allowed_wrapper_blocks] action hook (https://developer.wordpress.org/reference/hooks/excerpt_allowed_wrapper_blocks/) which is used by the excerpt_remove_blocks function
I might be over simplifying due to ignorance, but the term description field doesn'tappear to be far removed from the post excerpt field.
(Ignoring the stack of excerpt generative and santization filter requirements)
My point. The Wordpress Classic Editor block allows for an entity to be edited in both classic and editor modes and the content and assiciated functions survive both experiences.
Though as I am composing this post it occurs to me that both the excerpt and core/comment blocks require the block-editor to function, and the form fields required for settings/options would be the same form fields which are still in experimental development phase. For some reason I was dreaming of an opt-in switch that would magically interchange admin settings page with block editor page. (aka wordpress-classic editor plugin) - but realilty just slapped me upside-the-head.

@jonathan-dejong
Copy link

jonathan-dejong commented Aug 29, 2024

While I am also desperately waiting for this I have to strongly disagree here. Due to the backwards compatibility commitment of WP nothing ever is temporary. If it takes time that sucks but is still better than getting a half-baked stopgap solution that will only cause much more pain in the long term.

On principle I agree with this BUT consider that this is a 5 year old thread and one of the biggest hurdles in my opinion with WP as an eco system is that we are consistently falling behind due to this mentality.
We've gone from inventing the web to just trying to constantly catch up with everyone else. As a developer who's built his whole career on WordPress I love and appreciate it and the community so much, but it's also more and more disheartening experiencing this first hand.
Having to tell a client that it could be years still for "that block editor we have for pages should also be used for rich content on terms" makes absolutely no sense to them 😞

WooCommerce now has a block editor experience for product pages which are far more complex than a terms edit page.. @goaround have made a decent POC using the block-everywhere plugin.
We know this is possible, there's a will to make it happen from the community, a desire for it to be a thing from our users, but even if I had the time to make it I'm still not seeing any evidence that my efforts would not just be in vain anyway due to some abstract "grand admin redesign plan" that's likely years away 🤷‍♂️

On a constructive note how we decided to "solve" this for our clients is that we've made a "Block areas" post type which is just a non-public post type where one can create posts containing blocks. Then in edit screens for any terms or other locatiosn where blocks are currently not supported we have two inputs "Add block areas above content" and "Add block areas below content". which allows for searching and picking any number of these posts in both locations.
For slightly easier admin we've also made sure to link through to the posts and the post table screen from these sections and have added a column to the block area posts table showing where the posts have been added to.
This is definitely not ideal, but it gives a lot more flexibility to our clients with hardly any error-prone coding like matching up slugs between terms/posts and other solutions posted here. Not that I consider those approaches bad! Just a different way to skin this cat.

@bph bph added the [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. label Sep 28, 2024
@bph
Copy link
Contributor

bph commented Sep 28, 2024

Also suggested on this Reddit comment:

Gutenberg still is not supported for categories, tags, and other term pages, and this issue is at least five years old. In other words, you have to use stupid workarounds to have some custom content on the category page.

It's not an issue if you are making some simple marketing sites, but if you have something more complex than a blog, you have to use custom taxonomies and post types.

@Jeff1Jeff
Copy link

Jeff1Jeff commented Sep 30, 2024

I really don't understand why team spending time on changing colors and moving fonts here and there in Gutenberg. Also making full block themes in parallel when taxonomy system is still in Netscape era.
Isn't it one of most crucial parts of modern CMS?

@asafm7
Copy link

asafm7 commented Sep 30, 2024

I feel that this thread isn't reaching the right people. I wonder who they are.

@bph
Copy link
Contributor

bph commented Oct 2, 2024

@mtias @youknowriad Could this be part of WP redesign project? It seems to be a adoption blocker to not be able to add blocks to Category pages and still have to deal with a basic textarea box.

@Wohlfarth
Copy link

Obviously this thread hasn't reached the right people.
I have submitted a new feature request at https://core.trac.wordpress.org/ticket/62649
Hopefully someone will react there.
Happy day all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. Needs Design Needs design efforts. Needs Technical Feedback Needs testing from a developer perspective. [Type] Feature New feature to highlight in changelogs.
Projects
None yet
Development

No branches or pull requests